Need help solving cone resize in computer geometry/graphics.

Started by
5 comments, last by Alberth 8 months, 1 week ago

This may not be related to computer games but I am having trouble workign on this in our editor/tool.

I have a cone defined in 3D and as a standard it is defined via the parameters apex, angle and axis/direction. We also derived the hmin and hmax or the minimum and maximum height position along the axis from the apex where the nearest and the farthest point in the mesh that has data.I can compute the top and bottom parameters based on the given parameters.

See illustration of what our cone looks like with its parameters.

The black line at the side of the cone is just for illustration by the way, but the only thing rendered in our ap is the mesh from the hmin to hmax mesh.

In our application, we allow editing of the cone by dragging either the top or the button surfaces.(colored red bellow)


say for example, when the top is dragged, I am having a hard time on how to update the other parameters based on the new mesh look.


What I will have is a new height (which is the height between hmin and hmax), and I want to know how to compute for the new angle, the new hmin and hmax and new apex.
technically, I also have the information about the top radius (radius at hmin) and bottom radius.

From the graphics above, both the top and bottom radius did not change. So I think we can use it as well to compute for the updated parameters (I assume)

Anyone can help?

Advertisement

Maybe this will help. Use similar right triangles and trigonometry.

@Aressera Thanks for your reply, failed to see that I can use right triangles to solve it

Can you help me a little how can I derive the values from the original given values (on my first image)?
hmin, hmax,, height, apex, top radius, bottom radius
like how do i get the base length of the triangle from old hmax and hmin (or maybe from bottom radius)?
because the thing is, after resize, I only get the new height and the rest is I need to compute.

Let's define a few variables.

big triangle vertical = bv, big triangle horizontal = bh. For the small triangle we have sv and sh in a similar way.

Now since the angles of the both triangles are the same, their sides have the same ratio, that is bv/bh = sv/sh.

Also, sh = bottom_radius - upper_radius, bh = bottom_radius, and sv = height.

@Alberth thanks again, just so i get you perfectly when you say “big triangle vertical” or “big triangle horizontal”
you are refering to these two right?

yes

This topic is closed to new replies.

Advertisement