Skip to content

Commit b364326

Browse files
committed
Merge branch 'master' of github.com:JuliaGeometry/GeometryBasics.jl
2 parents 2d9f476 + 415e484 commit b364326

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/rectangles.jl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,15 @@ function coordinates(rect::Rect3D)
549549
# TODO use n
550550
w = widths(rect)
551551
o = origin(rect)
552-
return (ntuple(j-> o[j] + ((i >> (j - 1)) & 1) * w[j], 3) for i in 0:7)
552+
return ((x .* w .+ o) for x in Point{3, Int}[
553+
(0, 0, 0), (0, 0, 1), (0, 1, 1), (0, 1, 0),
554+
(0, 0, 0), (1, 0, 0), (1, 0, 1), (0, 0, 1),
555+
(0, 0, 0), (0, 1, 0), (1, 1, 0), (1, 0, 0),
556+
557+
(1, 1, 1), (0, 1, 1), (0, 0, 1), (1, 0, 1),
558+
(1, 1, 1), (1, 0, 1), (1, 0, 0), (1, 1, 0),
559+
(1, 1, 1), (1, 1, 0), (0, 1, 0), (0, 1, 1)
560+
])
553561
end
554562

555563
function texturecoordinates(rect::Rect3D)
@@ -558,11 +566,11 @@ end
558566

559567
function faces(rect::Rect3D)
560568
return QuadFace{Int}[
561-
(1,3,4,2),
562-
(2,4,8,6),
563-
(4,3,7,8),
564-
(1,5,7,3),
565-
(1,2,6,5),
566-
(5,6,8,7),
569+
(1,2,3,4),
570+
(5,6,7,8),
571+
(9,10,11,12),
572+
(13,14,15,16),
573+
(17,18,19,20),
574+
(21,22,23,24),
567575
]
568576
end

test/geometrytypes.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ using Test, GeometryBasics
22

33
@testset "algorithms.jl" begin
44
cube = Rect(Vec3f0(-0.5), Vec3f0(1))
5-
cube_faces = decompose(TriangleFace{Int}, QuadFace{Int}[
6-
(1,3,4,2),
7-
(2,4,8,6),
8-
(4,3,7,8),
9-
(1,5,7,3),
10-
(1,2,6,5),
11-
(5,6,8,7),
12-
])
5+
cube_faces = decompose(TriangleFace{Int}, faces(cube))
136
cube_vertices = decompose(Point{3,Float32}, cube)
147
@test area(cube_vertices, cube_faces) == 6
158
mesh = Mesh(cube_vertices, cube_faces)
@@ -121,7 +114,7 @@ end
121114
@test decompose(Point2f0, mesh) == pt_expa
122115

123116
b = Rect(Vec(1,1,1),Vec(1,1,1))
124-
pt_expb = Point{3,Int}[(1,1,1),(2,1,1),(1,2,1),(2,2,1),(1,1,2),(2,1,2),(1,2,2),(2,2,2)]
117+
pt_expb = Point{3,Int64}[[1, 1, 1], [1, 1, 2], [1, 2, 2], [1, 2, 1], [1, 1, 1], [2, 1, 1], [2, 1, 2], [1, 1, 2], [1, 1, 1], [1, 2, 1], [2, 2, 1], [2, 1, 1], [2, 2, 2], [1, 2, 2], [1, 1, 2], [2, 1, 2], [2, 2, 2], [2, 1, 2], [2, 1, 1], [2, 2, 1], [2, 2, 2], [2, 2, 1], [1, 2, 1], [1, 2, 2]]
125118
@test decompose(Point{3,Int}, b) == pt_expb
126119
mesh = normal_mesh(b)
127120
end

0 commit comments

Comments
 (0)