Create a circle in three-dimensional space

How to create a circle in three-dimensional space?

For a circle in two-dimensional space, two terms are sufficient.

1 center;

2 radius;

but in 3D, how can I determine the direction and position of a circle?

+3
source share
3 answers

One possibility would be to include a vector normal to the plane on which the circle lies. This has the advantage that if you ever decide to make a circle, normal will be used to identify things like reflections from the surface defined by that circle.

+3
source

Do you really need a circle (2D shape) in 3D space? Then this may be the solution:

  • x,y,z: Circle center coordinates
  • dx,dy,dz:
  • r: radius
+2

Depending on what you want to do with the object, I have another alternative. Select the circle as a unit circle in the xy plane with z = 0. with scaling, translation and rotation. If you plan on doing many matrix operations on your objects, this might be the way to go.

You can also save the position of the circle, radius, and normal plane as properties. and have a conversion method between two descriptive 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
+1
source

Source: https://habr.com/ru/post/1732204/


All Articles