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

clockwise #1

Open
positiveblue opened this issue Nov 6, 2014 · 0 comments
Open

clockwise #1

positiveblue opened this issue Nov 6, 2014 · 0 comments

Comments

@positiveblue
Copy link

Chapter 3 - Excercices -10 11 12

Hi guys,

I have found a trouble. For u in function directOf when sing > 0 return RIGHT.
This are extract from Cross Product from http://en.wikipedia.org/wiki/Graham_scan and in this case when sign > 0 you must return LEFT. For understand it better you can draw a three points, after that join P3 and P1 if u are doing the same direction that a clock you are going to Right, else you are going to Left (less when u cant build the triangle). Then the function should be:

directionOf a v b
| sign > 0 = LEFT
| sign < 0 = RIGHT
| otherwise = STRAIGHT
where sign = (x v - x a) * (y b - y a) - (y v - y a) * (x b - x a)

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

1 participant