Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add space=:transformed #2766

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions ReferenceTests/src/tests/short_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ end
lines!([50,50], [0, 100]; space=:pixel)
lines!([0,1], [0.25, 0.25]; space=:clip)
scatter!(Point2f(0.5, 0), space=:relative)
lines!([Point2f(50, 3), Point2f(55, 4)]; space=:transformed)
f
end

Expand Down
4 changes: 2 additions & 2 deletions src/camera/projection_math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ end

# project between different coordinate systems/spaces
function space_to_clip(cam::Camera, space::Symbol, projectionview::Bool=true)
if is_data_space(space)
if is_data_space(space) || is_transformed_space(space)
return projectionview ? cam.projectionview[] : cam.projection[]
elseif is_pixel_space(space)
return cam.pixel_space[]
Expand All @@ -330,7 +330,7 @@ function space_to_clip(cam::Camera, space::Symbol, projectionview::Bool=true)
end

function clip_to_space(cam::Camera, space::Symbol)
if is_data_space(space)
if is_data_space(space) || is_transformed_space(space)
return inv(cam.projectionview[])
elseif is_pixel_space(space)
w, h = cam.resolution[]
Expand Down
3 changes: 2 additions & 1 deletion src/units.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@

########################################

spaces() = (:data, :pixel, :relative, :clip)
spaces() = (:data, :pixel, :relative, :clip, :transformed)

Check warning on line 130 in src/units.jl

View check run for this annotation

Codecov / codecov/patch

src/units.jl#L130

Added line #L130 was not covered by tests
is_data_space(space) = space === :data
is_pixel_space(space) = space === :pixel
is_relative_space(space) = space === :relative
is_clip_space(space) = space === :clip
is_transformed_space(space) = space === :transformed
Loading