Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #195 from mforets/mforets/width
Browse files Browse the repository at this point in the history
Add width getter function for HyperCube
  • Loading branch information
SimonDanisch authored Feb 24, 2020
2 parents 5d568be + 1dd37ca commit 595d187
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hypercube.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
origin(prim::HyperCube) = prim.origin
width(prim::HyperCube) = prim.width
widths(prim::HyperCube{N,T}) where {N,T} = Vec{N,T}(prim.width)
maximum(prim::HyperCube{N,T}) where {N,T} = origin(prim)+widths(prim)
minimum(prim::HyperCube{N,T}) where {N,T} = origin(prim)
1 change: 1 addition & 0 deletions test/hyperrectangles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using LinearAlgebra
@testset "Core" begin
x = centered(HyperCube)
@test origin(x) == Vec3f0(-0.5)
@test width(x) == 1.0f0
@test widths(x) == Vec3f0(1.0)
@test maximum(x) == Vec3f0(0.5)
@test minimum(x) == Vec3f0(-0.5)
Expand Down

0 comments on commit 595d187

Please sign in to comment.