Jump to content
  • Advertisement
Sign in to follow this  
datadawgx

Determining 3D points on a 3d circle with center and normal vector

This topic is 4579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. Here's a funcky question I haven't found a good answer for yet. I have a point in 3d space and a direction vector (basically, a ray). I want to determine a 3d point on the outer edge of the circle for some radius and some theta. I know it's possible, but the math isn't clear to me. Anyone have any clues as to how I can do it?

Share this post


Link to post
Share on other sites
Advertisement
If you mean circle:

You can always find the edge on the xy-parrelel-plane by adding (sinv, cosv) to the coordinate. You'll have to turn the apropriately if you want it to be on some other plane.

If you mean sphere:

No idea, but you'd need two angles two describe an exact point.

Share this post


Link to post
Share on other sites
right i know how to find values in 2d... i guess i'm trying to figure out how to rotate that circle's plane, like you said, such that the points on the actual circle rotate properly around the circle's center point.

i need to calculate this... cant use transforms. surely someone's done it.

Share this post


Link to post
Share on other sites
Quote:
Original post by datadawgx
i need to calculate this... cant use transforms. surely someone's done it.
The question probably has an easy answer, but perhaps you could clarify what you're after. It sounds like you have a point and a vector, and you want to create points on a circle centered on that point, and lying in a plane whose normal is perpendicular to the vector. Is that right?

Share this post


Link to post
Share on other sites
Quote:
Original post by datadawgx
right i know how to find values in 2d... i guess i'm trying to figure out how to rotate that circle's plane, like you said, such that the points on the actual circle rotate properly around the circle's center point.

Find the normal vector of the plane and rotate it?

Share this post


Link to post
Share on other sites
Quote:
Original post by datadawgx
any tips?
It kind of depends on what you're really doing (creating a mesh around a curve of some sort, for example), and what the constraints are. One solution though is to build an arbitrary local coordinate system around the point and the vector, and then use it to construct the vertices of the circle. Ask if you need help with the details (actually, this could probably stand to be in an FAQ somewhere, as it comes up quite often).

Share this post


Link to post
Share on other sites
i'm not trying to create geometry, per se, but i am looking for vertex-like information (3d points on the circle's arc). i think i understand what you are saying about the local coordinate system... essentially, i'd be picking points from a circle that lies on a plane in 3d space, and then i want to rotate the circle's plane (and the defined points) such that the circle's normal points in the desired direction.

i can't wrap myself around the math. are matrix transforms in inevidable?

Share this post


Link to post
Share on other sites
This is all you need.

It's about moving cameras around without gimbal lock, but think about it: you want to rotate a vector around another one. Quaternions are (I haven't gotten into them much) fast and easy to use.

Have fun!

Share this post


Link to post
Share on other sites
Say you have point 'P' which is the centre of your circle and normal 'N'. You can create a random point 'A' that lies on the circle of given radius as follows:

- create a random vector 'V' (e.g. 0.34234, 0.565754, -0.5443) those numbers can be picked randomly. Just make sure the numbers you pick do not result in a null vector or one that is parallel with your vector N, or you will have trouble in the normalisation stage.

- create vector 'R' where: R = crossproduct(N, V)

- normalise(R)

// R is a random vector of unit length lying in the plane defined by normal N

- A = P + R * radius

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!