What is that area of the outer ellipse?Is it possible to calculate the area marked with yellow color?
An ellipse with radius a and b and inner closed curve is parallel with ellipse with length x0
View attachment 34213
When I specified a and b, the area of the outer ellipse is πab.What is that area of the outer ellipse?
What are the lengths of major and minor axes of the inner ellipse?
Continue...,..
When I specified a and b, the area of the outer ellipse is πab.
Inner shape is not an ellipse , just parallel with outer ellipse with distance x0.
Secondly, if I can solve this problem, I don't write this question here, definitely.
You're right that the inner curve is not an ellipse:When I specified a and b, the area of the outer ellipse is πab.
Inner shape is not an ellipse , just parallel with outer ellipse with distance x0.
Secondly, if I can solve this problem, I don't write this question here, definitely.
In the company where I work, a wooden product is produced in high circulation, and shape of the product from above is like the one I drew.Where does the problem come from?
Is it possible to calculate the area marked with yellow color?
An ellipse with radius a and b and inner closed curve is parallel with ellipse with length x0
View attachment 34213
When I specified a and b, the area of the outer ellipse is πab.
Inner shape is not an ellipse , just parallel with outer ellipse with distance x0.
Secondly, if I can solve this problem, I don't write this question here, definitely.
You could approximate very closely with a Planimeter.In the company where I work, a wooden product is produced in high circulation, and shape of the product from above is like the one I drew.
The yellow part is the part of the product that is dyed. To calculate the price of the finished paint, I must have its area.
What is a typical value of bx0 ?In the company where I work, a wooden product is produced in high circulation, and shape of the product from above is like the one I drew.
The yellow part is the part of the product that is dyed. To calculate the price of the finished paint, I must have its area.
Are you absolutely sure the inner shape is a parallel curve to the ellipse? Have you seen what happens in the link in post#5 when "x0" becomes large - the parallel curve starts to intersect/ cross itself.When I specified a and b, the area of the outer ellipse is πab.
Inner shape is not an ellipse , just parallel with outer ellipse with distance x0.
Secondly, if I can solve this problem, I don't write this question here, definitely.
I believe the inner curve (the edge of your thick pen) would self-intersect, but in your picture it is covered by ink. In the picture below the blue and the green curves would be drawn by the edges of the diameter which is orthogonal to the ellipse:Are you absolutely sure the inner shape is a parallel curve to the ellipse? Have you seen what happens in the link in post#5 when "x0" becomes large - the parallel curve starts to intersect/ cross itself.
Could it be that the curve you're actually after is the inner edge of the coloured area you'd get by drawing the ellipse with a really thick (circular nib) pen, like this...
View attachment 34214
...note that this inner curve would never self-intersect.
You don't need a mathematically precise area. If the thickness x0 is relatively small, you could just pretend the inner curve is an ellipse, which would lead to an easy calculation that is likely to be reasonably accurate.In the company where I work, a wooden product is produced in high circulation, and shape of the product from above is like the one I drew.
The yellow part is the part of the product that is dyed. To calculate the price of the finished paint, I must have its area.
What is a typical value of bx0 ?
I believe the inner curve (the edge of your thick pen) would self-intersect, but in your picture it is covered by ink. In the picture below the blue and the green curves would be drawn by the edges of the diameter which is orthogonal to the ellipse:
x0 is between 1 and 2 cm. Precisely, when the painter paints the body around the product, some color is also used around and above the product, which becomes a significant number in the high number of products, because polyester and thinner are also used.Are you absolutely sure the inner shape is a parallel curve to the ellipse? Have you seen what happens in the link in post#5 when "x0" becomes large - the parallel curve starts to intersect/ cross itself.
Price problems are usually the province of cost accountants. Splitting hair over this area dilemma becomes meaningless for them average minded practitioners as they would probably just do that, that is, compute the amount of paint consumed on a production run and do some minor average reckoning....
The yellow part is the part of the product that is dyed. To calculate the price of the finished paint, I must have its area.
What about 'b' ?x0 is between 1 and 2 cm.
import sys
import math
# configure here...
a=3
b=2 # Must be less than a
k=1.7 # thickness
n=1000 # increase this for more accuracy, up to a sensible amount
############
def binarySearch(func, target, bot, top, acc):
bv = func(bot) - target >= 0
tv = func(top) - target >= 0
if tv == bv: sys.exit(-1)
while top - bot > acc:
mid = (top + bot)*0.5
mv = func(mid)-target >= 0
if mv == bv:
bot = mid
else:
top = mid
return (top + bot)*0.5
############
def get_xy(t):
s = k/math.sqrt((a*math.sin(t))**2 + (b*math.cos(t))**2)
return [ (a - b*s)*math.cos(t), (b - a*s)*math.sin(t) ]
############
min_t = 0
max_t = math.pi*0.5
# Adjust min_t if there's an intersection
def gtz(t): return (a*math.sin(t))**2 + (b*math.cos(t))**2 - (a*k/b)**2
if gtz(0) < 0:
small = 1e-15
min_t = binarySearch(gtz, 0, 0,math.pi*0.5, small)
# print("New min_t", min_t)
area = math.pi*a*b # area of the ellipse
print(area - math.pi*(a-k)*(b-k), "<- result based on two ellipses")
if k < b:
inner_area = 0
# Calculate an approximate inner area using Trapezoidal rule
# https://en.wikipedia.org/wiki/Trapezoidal_rule#Non-uniform_grid
[last_x, last_y] = get_xy(max_t)
for i in range(1, n+1):
t = max_t - (max_t - min_t)*i/n
[x,y] = get_xy(t)
# print(x, y, inner_area)
inner_area += (y + last_y) * 0.5 * (x - last_x)
last_x = x
last_y = y
inner_area *= 4 # the above just integrates over one quadrant
# print(area, inner_area)
area -= inner_area
print(area, "<- result from numerical integration")
That's beautiful.... It is supplied with no warranty of any kind.
Here's the python code that calculates the area. NOTE: I'm not at all sure that it's correct. It is supplied with no warranty of any kind
Thanks for looking at my code! I intentionally programmed it to only consider the part of the parallel curve shown in green below, the red part is deliberately excluded because I considered it as being hidden by the "thick pen" discussed in post#9. Only the area within the green lines below would remain unpainted. The red lines would be painted over (I think)But when I plot both the inner ellipse and the actual curve I got the pictures below (the whole and zoomed inner curves), which I don't know how relate to the numbers.
I just wanted to ensure that a ≥ b ≥ k. I did these separately in...BTW, if you want to avoid self-intersection you want to use k≤ab2 instead of k<b.
# No warranty of any kind
import sys
import math
# configure here...
a=3
b=2 # Must be less than a
k=1.96 # thickness, must be less than b
n=1000 # increase this for more accuracy, up to a sensible amount
############
def binarySearch(func, target, bot, top, acc):
bv = func(bot) - target >= 0
tv = func(top) - target >= 0
if tv == bv: sys.exit(-1)
while top - bot > acc:
mid = (top + bot)*0.5
mv = func(mid)-target >= 0
if mv == bv:
bot = mid
else:
top = mid
return (top + bot)*0.5
############
def get_xy(t):
s = k/math.sqrt((a*math.sin(t))**2 + (b*math.cos(t))**2)
return [ (a - b*s)*math.cos(t), (b - a*s)*math.sin(t) ]
############
min_t = 0
max_t = math.pi*0.5
# Adjust min_t if there's an intersection
def gtz(t): return (a*math.sin(t))**2 + (b*math.cos(t))**2 - (a*k/b)**2
if gtz(0) < 0:
small = 1e-15
min_t = binarySearch(gtz, 0, 0,math.pi*0.5, small)
# print("New min_t", min_t)
area = math.pi*a*b # area of the ellipse
print(area - math.pi*(a-k)*(b-k), "<- result based on two ellipses")
inner_area = 0
# Calculate an approximate inner area using Trapezoidal rule
# https://en.wikipedia.org/wiki/Trapezoidal_rule#Non-uniform_grid
[last_x, last_y] = get_xy(max_t)
for i in range(1, n+1):
t = max_t - (max_t - min_t)*i/n
[x,y] = get_xy(t)
# print(x, y, inner_area)
inner_area += (y + last_y) * 0.5 * (x - last_x)
last_x = x
last_y = y
inner_area *= 4 # the above just integrates over one quadrant
# print(area, inner_area)
area -= inner_area
print(area, "<- result from numerical integration")