How to describe an ellipse suitable for 3D (geometry, renderer, physics), in any language

0 Votes
    535 Views

I can think of two ways to create an Ellipse class.

In math, an ellipse is described by two focal points and the major or semi-major axis length.

A typical structure would be like this:

  • focus1: Vector3D
  • focus2: Vector3D
  • semiMajorAxis: double
  • planeNormal: Vector3D

However, I found it to be sub-optimal, because 99% of time, I don’t really care about the focal points.

It looks harder to figure out how to intersect with lines/rays, or to perform projections.

Instead, I would represent an ellipse as a stretched circle along a vector.

The structure would be something like this:

  • center: Vector3D
  • radius: double
  • stretchVector: Vector3D (the axis along which the stretch is applied)
  • stretchRate: double
  • planeNormal: Vector3D

The idea is to perform all tests/traces/projections as if it was done against a mere circle, simply by scaling in and out values before sending them to my circle methods.

However I’m lacking experience in that domain, so I’m not sure which one is:

  • the easier to use
  • the faster to compute (it’s 3D, so I need good perfs!)

EDIT: Actually I need ellipse as faces of volume (cylinder section, cone section) rather than movements. So my main use would be to raycast or to intersect it with lines, planes, circles, other ellipses, etc…

2

Answers


Please signup or login to answer this question.