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

Perspective deformation of square vertices yields extra point #244

Closed
byorgey opened this issue Mar 31, 2015 · 3 comments
Closed

Perspective deformation of square vertices yields extra point #244

byorgey opened this issue Mar 31, 2015 · 3 comments

Comments

@byorgey
Copy link
Member

byorgey commented Mar 31, 2015

> let sq = unitSquare # rotateBy (1/17) # translate (3 ^& 2) :: Path V2 Double
> let pts = concat $ pathPoints sq
> pts
[P (V2 3.6468569477957544 1.7143847183913987),P (V2 3.2856152816086013 2.6468569477957544),P (V2 2.3531430522042456 2.2856152816086013),P (V2 2.7143847183913983 1.3531430522042456)]
> map (\p -> p ^/ (p ^. _x)) pts
[P (V2 1.0 0.47009925065133495),P (V2 1.0 0.8055894317912602),P (V2 1.0 0.9713031596050272),P (V2 1.0 0.4985082044693159)]
> concat . pathPoints $ deform perspectiveX1 sq
[P (V2 1.0 0.47009925065133495),P (V2 1.0 0.8055894317912602),P (V2 1.0 0.9713031596050272),P (V2 1.0 0.7180539502766538),P (V2 1.0 0.4985082044693159)]

The last two expressions ought to yield equal results, but there is an extra spurious point inserted in the result of calling deform perspectiveX1.

@byorgey
Copy link
Member Author

byorgey commented Mar 31, 2015

Maybe this is not actually a bug, but just due to some numerical approximation, i.e. the system thinks it needs to subdivide one of the segments to approximate its deformation accurately enough. Perhaps the real solution is that I should just directly deform points instead of deforming paths where I only care about the vertices.

@byorgey
Copy link
Member Author

byorgey commented Mar 31, 2015

I'm not sure whether this is a bug, but I worked around it by directly deforming points, which was probably a better way to do it anyway. I'm going to close this for now.

@byorgey byorgey closed this as completed Mar 31, 2015
@bergey
Copy link
Member

bergey commented Mar 31, 2015

OK. I can easily believe either that it's a bug or that it's subdivision, as you say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants