How to design a circle in the 3-D space?
For a circle in the 2-D space, two members are enough.
1 center;
2 radius;
but in 3D, how can I define the direction and the position of the circle?
How to design a circle in the 3-D space?
For a circle in the 2-D space, two members are enough.
1 center;
2 radius;
but in 3D, how can I define the direction and the position of the circle?
Do you really want a Circle (a 2D Shape) in a 3D Space? Then this could be solution:
x,y,z
: Coordinates of the center of the circledx,dy,dz
: Direction of the plane the circle is located inr
: radiusOne possibility would be to include a vector that's normal to the plane on which the circle lies. This has the advantage that if you ever decide to render the circle, the normal will be used to determine things like reflections off the surface defined by that circle.
Depending on what you want to do with the object - I have another alternative. Model the circle as a unit circle in the xy plane with z=0. with scaling, translating, and rotating operations done to it. If you plan on doing many matrix operations on your objects, this may be the way to go.
You could also keep the unit circle's position, radius, and normal to plane information as properties. and have a method to convert between the two describing methods .
Circle() - Default Unit circle at (0,0,0), radius 1, xy plane at z=0
Circle(scale, translate, rotate) - my constructor
Circle(location, radius, normal) - the other proposed constructor