Skip to content

Commit b1d9aff

Browse files
authored
revert name change of rotation(::Cylinder) (#258)
1 parent 1a35ede commit b1d9aff

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/primitives/Cone.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function coordinates(c::Cone{T}, nvertices=30) where {T}
3030
nvertices += isodd(nvertices)
3131
nhalf = div(nvertices, 2)
3232

33-
R = cylinder_rotation_matrix(direction(c))
33+
R = rotation(c)
3434
step = 2pi / nhalf
3535

3636
ps = Vector{Point3{T}}(undef, nhalf + 2)
@@ -48,7 +48,7 @@ function normals(c::Cone, nvertices = 30)
4848
nvertices += isodd(nvertices)
4949
nhalf = div(nvertices, 2)
5050

51-
R = cylinder_rotation_matrix(direction(c))
51+
R = rotation(c)
5252
step = 2pi / nhalf
5353

5454
ns = Vector{Vec3f}(undef, nhalf + 2)

src/primitives/cylinders.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ height(c::Cylinder) = norm(c.extremity - c.origin)
2222
direction(c::Cylinder) = (c.extremity .- c.origin) ./ height(c)
2323

2424
"""
25-
cylinder_rotation_matrix(direction::VecTypes{3})
25+
rotation(prim::GeometryPrimitive)
26+
rotation(direction::VecTypes{3})
2627
27-
Creates a basis transformation matrix `R` that maps the third dimension to the
28-
given `direction` and the first and second to orthogonal directions. This allows
29-
you to encode a rotation around `direction` in the first two components and
30-
transform it with `R * rotated_point`.
28+
Creates a rotation matrix `R` that rotates the z direction to `direction`. The
29+
x and y directions remain orthogonal to `direction`, i.e act as radial directions.
3130
"""
32-
function cylinder_rotation_matrix(d3::VecTypes{3, T}) where {T}
31+
rotation(prim::GeometryPrimitive) = rotation(direction(prim))
32+
function rotation(d3::VecTypes{3, T}) where {T}
3333
u = Vec{3, T}(d3[1], d3[2], d3[3])
3434
if abs(u[1]) > 0 || abs(u[2]) > 0
3535
v = Vec{3, T}(u[2], -u[1], T(0))
@@ -46,7 +46,7 @@ function coordinates(c::Cylinder{T}, nvertices=30) where {T}
4646
nvertices += isodd(nvertices)
4747
nhalf = div(nvertices, 2)
4848

49-
R = cylinder_rotation_matrix(direction(c))
49+
R = rotation(c)
5050
step = 2pi / nhalf
5151

5252
ps = Vector{Point3{T}}(undef, nvertices + 2)
@@ -68,7 +68,7 @@ function normals(c::Cylinder, nvertices = 30)
6868
nvertices += isodd(nvertices)
6969
nhalf = div(nvertices, 2)
7070

71-
R = cylinder_rotation_matrix(direction(c))
71+
R = rotation(c)
7272
step = 2pi / nhalf
7373

7474
ns = Vector{Vec3f}(undef, nhalf + 2)

0 commit comments

Comments
 (0)