triangulation-earclipping: Fix boolean

This commit is contained in:
Joseph Ferano 2024-08-12 14:57:58 +07:00
parent 8fe7b273a5
commit c5096cf3f9
2 changed files with 8 additions and 2 deletions

View File

@ -9,16 +9,22 @@ Several things can be created with this;
** Insertion :algorithm:
** Query :algorithm:
** Find Nearest Neighbor :algorithm:
** Morton codes
This is a technique that allows us to convert coordinates into an array index,
allowing us to pack them contiguously in memory
http://johnsietsma.com/2019/12/05/morton-order-introduction/
** Resources
[[http://ericandrewlewis.github.io/how-a-quadtree-works/][Visualize a Quadtree]]
[[http://donar.umiacs.umd.edu/quadtree/][Academic Interactive Demo]]
[[https://codepen.io/_bm/pen/ExPBMrW][Codepen (Js example)]]
[[https://gist.github.com/patricksurry/6478178][D3.js Example]]
** Notes
#+begin_src js
// exclude node if point is farther away than best distance in either axis
if (x < x1 - best.d || x > x2 + best.d || y < y1 - best.d || y > y2 + best.d) {
return best;
}
#+end_src
I don't know how to explain but I get it. Because of the euclidian distance and the fact that we're dealing with rectangles, the closest distance to a rectangle is a straight line in one of the x or y axis

View File

@ -117,7 +117,7 @@ def player_input(w: World):
if RL.is_key_pressed(RL.KEY_SPACE):
w.rotate_cam = not w.rotate_cam
if RL.is_key_pressed(RL.KEY_W):
w.draw_wireframe = not w.draw_wireframe
w.draw_wireframe[0] = not w.draw_wireframe[0]
def update(w: World):
pass
@ -140,7 +140,7 @@ def draw_3d(w: World):
RL.draw_model(w.model, RL.vector3_zero(), 1, RL.GREEN)
def draw_2d(w: World):
val = RL.gui_check_box(Rect(10, 30, 50, 50), "Draw Wireframe", w.draw_wireframe)
val = RL.gui_check_box(Rect(10, 30, 25, 25), "Draw Wireframe", w.draw_wireframe)
if val != 0:
print(val)
if val: