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

Add width getter function for HyperCube #195

Merged
merged 1 commit into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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