@@ -12,20 +12,37 @@ public class Circle3d
12
12
13
13
public Vector3d Center ;
14
14
public Vector3d Normal ;
15
- public Vector3d AxisX , AxisY ;
15
+ public Vector3d PlaneX , PlaneY ;
16
16
public double Radius ;
17
17
public bool IsReversed ; // use ccw orientation instead of cw
18
18
19
- public Circle3d ( Vector3d center , Vector3d axis0 , Vector3d axis1 , Vector3d normal , double radius )
19
+ public Circle3d ( Vector3d center , double radius , Vector3d axis0 , Vector3d axis1 , Vector3d normal )
20
20
{
21
21
IsReversed = false ;
22
22
Center = center ;
23
23
Normal = normal ;
24
- AxisX = axis0 ;
25
- AxisY = axis1 ;
24
+ PlaneX = axis0 ;
25
+ PlaneY = axis1 ;
26
+ Radius = radius ;
27
+ }
28
+ public Circle3d ( Vector3d center , double radius , Frame3f f , int nNormalAxis = 1 )
29
+ {
30
+ IsReversed = false ;
31
+ Center = center ;
32
+ Normal = f . GetAxis ( nNormalAxis ) ;
33
+ PlaneX = f . GetAxis ( ( nNormalAxis + 1 ) % 3 ) ;
34
+ PlaneY = f . GetAxis ( ( nNormalAxis + 2 ) % 3 ) ;
35
+ Radius = radius ;
36
+ }
37
+ public Circle3d ( Vector3d center , double radius )
38
+ {
39
+ IsReversed = false ;
40
+ Center = center ;
41
+ Normal = Vector3d . AxisY ;
42
+ PlaneX = Vector3d . AxisX ;
43
+ PlaneY = Vector3d . AxisZ ;
26
44
Radius = radius ;
27
45
}
28
-
29
46
30
47
public bool IsClosed {
31
48
get { return true ; }
@@ -41,14 +58,14 @@ public Vector3d SampleDeg(double degrees)
41
58
{
42
59
double theta = degrees * MathUtil . Deg2Rad ;
43
60
double c = Math . Cos ( theta ) , s = Math . Sin ( theta ) ;
44
- return Center + c * Radius * AxisX + s * Radius * AxisY ;
61
+ return Center + c * Radius * PlaneX + s * Radius * PlaneY ;
45
62
}
46
63
47
64
// angle in range [0,2pi] (but works for any value, obviously)
48
65
public Vector3d SampleRad ( double radians )
49
66
{
50
67
double c = Math . Cos ( radians ) , s = Math . Sin ( radians ) ;
51
- return Center + c * Radius * AxisX + s * Radius * AxisY ;
68
+ return Center + c * Radius * PlaneX + s * Radius * PlaneY ;
52
69
}
53
70
54
71
@@ -61,7 +78,7 @@ public double ParamLength {
61
78
public Vector3d SampleT ( double t ) {
62
79
double theta = ( IsReversed ) ? - t * MathUtil . TwoPI : t * MathUtil . TwoPI ;
63
80
double c = Math . Cos ( theta ) , s = Math . Sin ( theta ) ;
64
- return Center + c * Radius * AxisX + s * Radius * AxisY ;
81
+ return Center + c * Radius * PlaneX + s * Radius * PlaneY ;
65
82
}
66
83
67
84
public bool HasArcLength { get { return true ; } }
@@ -76,7 +93,7 @@ public Vector3d SampleArcLength(double a) {
76
93
double t = a / ArcLength ;
77
94
double theta = ( IsReversed ) ? - t * MathUtil . TwoPI : t * MathUtil . TwoPI ;
78
95
double c = Math . Cos ( theta ) , s = Math . Sin ( theta ) ;
79
- return Center + c * Radius * AxisX + s * Radius * AxisY ;
96
+ return Center + c * Radius * PlaneX + s * Radius * PlaneY ;
80
97
}
81
98
82
99
0 commit comments