33# ------------------------------------------------------------------
44
55"""
6- Torus(center, normal , major, minor)
6+ Torus(center, direction , major, minor)
77
88A torus centered at `center` with axis of revolution directed by
9- `normal ` and with radii `major` and `minor`.
9+ `direction ` and with radii `major` and `minor`.
1010
1111"""
1212struct Torus{C<: CRS ,Mₚ<: Manifold ,V<: Vec{3} ,ℒ<: Len } <: Primitive{𝔼{3},C}
1313 center:: Point{Mₚ,C}
14- normal :: V
14+ direction :: V
1515 major: :ℒ
1616 minor: :ℒ
17- Torus (center:: Point{Mₚ,C} , normal :: V , major: :ℒ , minor: :ℒ ) where {C<: CRS ,Mₚ<: Manifold ,V<: Vec{3} ,ℒ<: Len } =
18- new {C,Mₚ,V,float(ℒ)} (center, normal , major, minor)
17+ Torus (center:: Point{Mₚ,C} , direction :: V , major: :ℒ , minor: :ℒ ) where {C<: CRS ,Mₚ<: Manifold ,V<: Vec{3} ,ℒ<: Len } =
18+ new {C,Mₚ,V,float(ℒ)} (center, direction , major, minor)
1919end
2020
21- Torus (center:: Point , normal :: Vec , major:: Len , minor:: Len ) = Torus (center, normal , promote (major, minor)... )
21+ Torus (center:: Point , direction :: Vec , major:: Len , minor:: Len ) = Torus (center, direction , promote (major, minor)... )
2222
23- Torus (center:: Point , normal:: Vec , major, minor) = Torus (center, normal, addunit (major, u " m" ), addunit (minor, u " m" ))
23+ Torus (center:: Point , direction:: Vec , major, minor) =
24+ Torus (center, direction, addunit (major, u " m" ), addunit (minor, u " m" ))
2425
25- Torus (center:: Tuple , normal :: Tuple , major, minor) = Torus (Point (center), Vec (normal ), major, minor)
26+ Torus (center:: Tuple , direction :: Tuple , major, minor) = Torus (Point (center), Vec (direction ), major, minor)
2627
2728"""
2829 Torus(p1, p2, p3, minor)
@@ -44,18 +45,18 @@ paramdim(::Type{<:Torus}) = 2
4445
4546center (t:: Torus ) = t. center
4647
47- normal (t:: Torus ) = t. normal
48+ direction (t:: Torus ) = t. direction
4849
4950radii (t:: Torus ) = (t. major, t. minor)
5051
51- axis (t:: Torus ) = Line (t. center, t. center + t. normal )
52+ axis (t:: Torus ) = Line (t. center, t. center + t. direction )
5253
5354== (t₁:: Torus , t₂:: Torus ) =
54- t₁. center == t₂. center && t₁. normal == t₂. normal && t₁. major == t₂. major && t₁. minor == t₂. minor
55+ t₁. center == t₂. center && t₁. direction == t₂. direction && t₁. major == t₂. major && t₁. minor == t₂. minor
5556
5657Base. isapprox (t₁:: Torus , t₂:: Torus ; atol= atol (lentype (t₁)), kwargs... ) =
5758 isapprox (t₁. center, t₂. center; atol, kwargs... ) &&
58- isapprox (t₁. normal , t₂. normal ; atol, kwargs... ) &&
59+ isapprox (t₁. direction , t₂. direction ; atol, kwargs... ) &&
5960 isapprox (t₁. major, t₂. major; atol, kwargs... ) &&
6061 isapprox (t₁. minor, t₂. minor; atol, kwargs... )
6162
@@ -65,7 +66,7 @@ function (t::Torus)(θ, φ)
6566 if (θ < 0 || θ > 1 ) || (φ < 0 || φ > 1 )
6667 throw (DomainError ((θ, φ), " t(θ, φ) is not defined for θ, φ outside [0, 1]²." ))
6768 end
68- c, n⃗ = t. center, t. normal
69+ c, n⃗ = t. center, t. direction
6970 R, r = t. major, t. minor
7071
7172 Q = urotbetween (Vec (zero (ℒ), zero (ℒ), oneunit (ℒ)), n⃗)
0 commit comments