| 1 | package Modelica
|
|---|
| 2 | package Constants
|
|---|
| 3 | constant Real eps = 0.001;
|
|---|
| 4 | end Constants;
|
|---|
| 5 | end Modelica;
|
|---|
| 6 |
|
|---|
| 7 | function normalize
|
|---|
| 8 | input Real v[:];
|
|---|
| 9 | input Real eps = 100 * Modelica.Constants.eps;
|
|---|
| 10 | output Real result[size(v, 1)];
|
|---|
| 11 | algorithm
|
|---|
| 12 | result := smooth(0, if length(v) >= eps then v / length(v) else v / eps);
|
|---|
| 13 | end normalize;
|
|---|
| 14 |
|
|---|
| 15 | class _1139
|
|---|
| 16 | Real n_z_aux = 1;
|
|---|
| 17 | Real widthDirection[3] = {0,1,0};
|
|---|
| 18 | Real e_x[3] = {1,1,1};
|
|---|
| 19 | Real e_y[3](each final unit="1") = noEvent(
|
|---|
| 20 | cross(normalize(
|
|---|
| 21 | cross(e_x, if n_z_aux*n_z_aux > 1e-06 then widthDirection else if abs(e_x[1]) > 1e-06 then {0,1,0} else {1,0,0})
|
|---|
| 22 | ),
|
|---|
| 23 | e_x)
|
|---|
| 24 | );
|
|---|
| 25 | end _1139;
|
|---|
| 26 |
|
|---|
| 27 | // fclass _1139
|
|---|
| 28 | // Real n_z_aux = 1.0;
|
|---|
| 29 | // Real widthDirection[1] = 0.0;
|
|---|
| 30 | // Real widthDirection[2] = 1.0;
|
|---|
| 31 | // Real widthDirection[3] = 0.0;
|
|---|
| 32 | // Real e_x[1] = 1.0;
|
|---|
| 33 | // Real e_x[2] = 1.0;
|
|---|
| 34 | // Real e_x[3] = 1.0;
|
|---|
| 35 | // Real e_y[1](unit = "1") = cross(normalize(cross({e_x[1],e_x[2],e_x[3]},if noEvent(n_z_aux ^ 2.0 > 1e-06) then {widthDirection[1],widthDirection[2],widthDirection[3]} else if noEvent(abs(e_x[1]) > 1e-06) then {0.0,1.0,0.0} else {1.0,0.0,0.0}),0.1),{e_x[1],e_x[2],e_x[3]})[1];
|
|---|
| 36 | // Real e_y[2](unit = "1") = cross(normalize(cross({e_x[1],e_x[2],e_x[3]},if noEvent(n_z_aux ^ 2.0 > 1e-06) then {widthDirection[1],widthDirection[2],widthDirection[3]} else if noEvent(abs(e_x[1]) > 1e-06) then {0.0,1.0,0.0} else {1.0,0.0,0.0}),0.1),{e_x[1],e_x[2],e_x[3]})[2];
|
|---|
| 37 | // Real e_y[3](unit = "1") = cross(normalize(cross({e_x[1],e_x[2],e_x[3]},if noEvent(n_z_aux ^ 2.0 > 1e-06) then {widthDirection[1],widthDirection[2],widthDirection[3]} else if noEvent(abs(e_x[1]) > 1e-06) then {0.0,1.0,0.0} else {1.0,0.0,0.0}),0.1),{e_x[1],e_x[2],e_x[3]})[3];
|
|---|
| 38 | // end _1139;
|
|---|
| 39 |
|
|---|