I have a piece of torus face (from a more complex body) to analyse like this:

I would like to calculate the neutral axis length with:

- The surface TorusParams (TorusParams Property (ISurface)) which give me:
- a center point (x, y, z)
- an axis vector (x, y, z)
- a major radius (R on image)
- a minor radius (r on image)

- The extremity curves (CircleParams Property (ICurve)) which give me:
- the extremity points of neutral axis (x, y, z)
- other informations...

To calculate this length:

- I calculate an angle (rad) but the angle can be:
- small: angle
- large: 2*PI - angle

- To determine the angle to use, I calculate:
- the [center, extremity1] vector (x, y, z)
- the [center, extremity2] vector (x, y, z)
- the cross product of the vectors (x, y, z)
- the dot product with the torus axis vector
- if the dot product is positive (same direction):
- the torus turns in a clockwise direction

- if the dot product is negative (opposite direction)
- the torus turns in an anti-clockwise direction

- if the dot product is positive (same direction):

My problem is:

- The torus axis is based on a starting and ending point (extremity1 or extremity2) but I don't know which one.

How can I find it?

Thank you for your help.

How about you pick one point on the surface and check which segment it lies on.

For example, find the minimum and maximum U and V values for the surface and create a point at ((minU + maxU) / 2, (minV + maxV) / 2)

You can create a vector from the center point, towards the new point (call it point1), but in the plane of the neutral axis in a few different ways. One way is like this:

v1 = [center, point1]

v2 = v1 * axis (cross product)

v3 = v2 * axis - this should hopefully be a vector from the center, towards point1, but in the plane of the neutral axis

v3.Length = radius of neutral axis. Now the end point of v3 should be a point on the neutral axis, in between the extremities.