|
120 | 120 | - r4: Point on line r1 + lambda*r21 that is closest to the origin with 0<=lambda<=1, or r4_old, if it is closer. |
121 | 121 | - d4: Signed distance of r4 to the origin or d4_old if abs(d4_old) < norm(r1 + lambda*r21) |
122 | 122 | """ |
123 | | -function signedDistanceToLineSegmentWithR4(r1::SVector{3,Float64}, r2::SVector{3,Float64}, |
124 | | - r21::SVector{3,Float64}, e::SVector{3,Float64}, |
125 | | - r4_old::SVector{3,Float64}, d4_old::Float64=0.0) |
| 123 | +function signedDistanceToLineSegmentWithR4(r1::SVector{3,T}, r2::SVector{3,T}, |
| 124 | + r21::SVector{3,T}, e::SVector{3,T}, |
| 125 | + r4_old::SVector{3,T}, d4_old::T=T(0.0)) where {T} |
126 | 126 | # r = r1 + lambda*r21 (0 <= lambda <= 1) |
127 | 127 | # |
128 | 128 | # The closest point to the line is point r4, such that r21*r4 = 0 |
|
146 | 146 | - r4: Point on line r1 + lambda*r21 that is closest to the origin with 0<=lambda<=1. |
147 | 147 | - d4: Signed distance of r4 to the origin |
148 | 148 | """ |
149 | | -function signedDistanceToLineSegment(r1::SVector{3,Float64}, r2::SVector{3,Float64}, |
150 | | - r21::SVector{3,Float64}, e::SVector{3,Float64}) |
| 149 | +function signedDistanceToLineSegment(r1::SVector{3,T}, r2::SVector{3,T}, |
| 150 | + r21::SVector{3,T}, e::SVector{3,T}) where {T} |
151 | 151 | # r = r1 + lambda*r21 (0 <= lambda <= 1) |
152 | 152 | # |
153 | 153 | # The closest point to the line is point r4, such that r21*r4 = 0 |
|
168 | 168 | - r4: Point on triangle portal r1, r2, r3 that is closest to the origin. |
169 | 169 | - d : Signed distance of r4 to the origin: d > 0: origin is outside of tetrahedron r0,r1,r2,r3, otherwise inside. |
170 | 170 | """ |
171 | | -function signedDistanceToPortal(r0::SVector{3,Float64}, r1::SVector{3,Float64}, |
172 | | - r2::SVector{3,Float64}, r3::SVector{3,Float64}) |
| 171 | +function signedDistanceToPortal(r0::SVector{3,T}, r1::SVector{3,T}, |
| 172 | + r2::SVector{3,T}, r3::SVector{3,T}) where {T} |
173 | 173 | # Determine unit normal on portal |
174 | 174 | r21 = r2 - r1 |
175 | 175 | r31 = r3 - r1 |
|
0 commit comments