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

Episode 3: swicht-case-monster #4

Open
soraphis opened this issue Apr 21, 2016 · 0 comments
Open

Episode 3: swicht-case-monster #4

soraphis opened this issue Apr 21, 2016 · 0 comments

Comments

@soraphis
Copy link

https://gist.github.com/soraphis/eca47b2fcce35fb891a2e79ceb25bcc7

I'd do a minor change so you can replace this switch-case monster.

  • Square class, put Control Nodes and Nodes into arrays.
    rule: they are filled clockwise. and node[i] is between cnode[i] and cnode[(i+1)%4]
  • replace the TriangluateSquare method with what you see in the link above.

the logic behind this:
for each corner who can be active, we fill the corner and its adjacent nodes into a list. (also in clockwise order)
(so for each corner we would add 3 nodes)

if the first node we want to add is equal the last node in the list, we have adjacent control nodes which we want to add, so we don't need to add the node in between -> remove it from the list.

after processing all 4 cornerns, we need to make the same check for the first and the last node in the list. if they are the same, remove them.

@soraphis soraphis mentioned this issue Apr 21, 2016
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