Hi Louv,
the idea of previous post did not work out as I expected.
I apologize for that.
In order to do any 3D ellipse in 3D space, the idea is to stretch a 3D circle.
So, you have to find the correct transformation matrix to stretch the circle.
The idea is to find correct eigenvectors and eigenvalues, construct the transformation matrix, and then use the transformation.
the example I made below is drawing a circle, start from [0, 0, 0], and the circle center is at [1, 1, 0]
after drawing a circle, it is stretched in [-1, 1, 0] direction with scale of 2.
the eigenvectors and eigenvalues I choose are:
Lambda1 = 1, with V1=[-1/sqrt(2), -1/sqrt(2), 0], short-axis, from center to starting point
Lambda2 = 2, with V2=[-1/sqrt(2), +1/sqrt(2), 0], long-axis, from center to long-axis vertex point
Lambda3 = 1, with V3=[0, 0, 1], normal direction, NORMAL vector direction
let V=[V1, V2, V3], D=3x3 matrix with diagonal elements Lambda1, 2, 3
M = V*D*V'
with these, you can construct a transformation matrix:
[ 1.5 -0.5 0]
M = [ -0.5 1.5 0]
[ 0 0 1]
this is associated with XYZ axes.
so, with the following program, an ellipse can be drawn:
//=========
&1
#1->1000X
#2->1000Y
#3->1000Z
global Tdet = 0
open prog ellipse_test01
Tdet = tinit(1);
Tdata[1].Diag[6] = 1.5;
Tdata[1].Diag[7] = 1.5;
Tdata[1].Diag[8] = 1;
Tdata[1].xyz[0] = -0.5;
Tdata[1].xyz[1] = 0;
Tdata[1].xyz[2] = -0.5;
Tdata[1].xyz[3] = 0;
Tdata[1].xyz[4] = 0;
Tdata[1].xyz[5] = 0;
abs
linear
TA 0 TS 50 TD 0
F 5
X 0 Y 0
dwell 1000
normal K-1
abs
dwell 0
Gather.Enable=2
dwell 0
tsel -1
circle1
I 1 J 1
dwell 0
tsel 1
circle1
I 1 J 1
tsel -1
dwell 0
Gather.Enable=0
dwell 0
close
//=========