Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

Equation of cone along an arbitrary axis

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 CSDevelopmentRegina   Members   -  Reputation: 167


Posted 12 December 2012 - 02:37 PM

Hi all.

I'm looking for an equation for a cone along an arbitrary axis and I've run a few Google searches, but haven't come across much except for:

"Let V be the vertex, A be a unit vector in the direction of the axis of rotation, and B,C be unit vectors such that A,B,C are mutually orthogonal. Let theta be the angle between the cone and the axis.
To get to an arbitrary point on the cone, we start at P, travel a length of s along the axis (where s is an arbitrary real number), and then travel a distance of s*sin(theta) in any direction perpendicular to the axis. An arbitrary direction perpendicular to A has the form B*cos(t) + C*sin(t), where t runs from 0 to 2π.
Putting this together gives us a parametrization of:
P + s * A + s * sin(theta) * (B * cos(t) + C * sin(t))."

I'm not sure how this fits into what I'd like to do though. Specifically, I'm attempting to find a way to construct a cone such that its vertex is at point p = (px,py,pz) and the cone runs tangent to a sphere with origin o = (sx,sy,sz) and radius r. In other words, I want the cone to run along the axis defined by the vector o - p, with height equal to the length of said vector and its base have radius r.

This is not homework. I'm going to use the cone to construct a circle on a plane that intersects with the cone. I know that the conic section formed by the cone-plane intersection will not be a perfect circle - I'm just interested in an approximation.

Thanks in advance.


#2 Sepii   Members   -  Reputation: 200


Posted 13 December 2012 - 10:37 AM

the parametric equation of a cone is : (x/a)^2 + (y/b)^2 = z^2 ,with this you can get an elliptic cone with radii a en b.

So the z will be the direction normal, x and y will be the vectors that are perpendicular to the normal.
I will call these variables x', y' and z'. And those will be the axes of the local frame of reference.

The only step you need to make at this point to get it to the 'normal' frame of reference is to get the projection of the local axes on the normal axes. So first you have to normalise all the local axes and the normal axes. And then you can take the dot products of each axes.

x' dot x * t + x' dot y * s + x' dot z * r = at + bs + cr, which is the direction of x'.
y' dot x * t + y' dot y * s + y' dot z * r = dt + es + fr, which is the direction of y'.
z' dot x * t + z' dot y * s + z' dot z * r = gt + hs + ir, which is the direction of z'.

here t, s and r are the variables which replaces the x,y and z from the cone equation. Because x,y and z are now used as axes (vectors ).

Now you just need to fill these in, in the cone equation. And you get:

( (at + bs + cr) / r_x )^2 + ( ( dt + es + fr ) / r_y) ^2 = ( gt + hs + ir )^2

And this equation then describes the random orientated cone around axes x', y' and z'.
To translate the cone with the vector ( v,w,u ) you just need to replace t with t - v; s with s - w; and z with z - u;

That's all. Hoped it helped.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.