Skip to content

Commit

Permalink
datatypes,examples: fix typos, and silence notice in the quadtree exa…
Browse files Browse the repository at this point in the history
…mple (#20577)
  • Loading branch information
pierrec committed Jan 18, 2024
1 parent 9c7e370 commit 45e13ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/quadtree_demo/quadtree_demo.v
Expand Up @@ -112,7 +112,7 @@ fn (mut app App) find_particles() {

fn main() {
mut app := &App{
gg: 0
gg: unsafe { nil }
}
app.gg = gg.new_context(
bg_color: gx.white
Expand Down
8 changes: 4 additions & 4 deletions vlib/datatypes/quadtree.v
Expand Up @@ -35,7 +35,7 @@ pub fn (mut q Quadtree) create(x f64, y f64, width f64, height f64, capacity int
}
}

// insert recursevely adds a particle in the correct index of the tree.
// insert recursively adds a particle in the correct index of the tree.
pub fn (mut q Quadtree) insert(p AABB) {
mut indexes := []int{}

Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn (mut q Quadtree) insert(p AABB) {
}
}

// retrieve recursevely checks if a particle is in a specific index of the tree.
// retrieve recursively checks if a particle is in a specific index of the tree.
pub fn (mut q Quadtree) retrieve(p AABB) []AABB {
mut indexes := q.get_index(p)
mut detected_particles := q.particles.clone()
Expand All @@ -77,7 +77,7 @@ pub fn (mut q Quadtree) retrieve(p AABB) []AABB {
return detected_particles
}

// clear flushes out nodes and partcles from the tree.
// clear flushes out nodes and particles from the tree.
pub fn (mut q Quadtree) clear() {
q.particles = []
for j in 0 .. q.nodes.len {
Expand All @@ -88,7 +88,7 @@ pub fn (mut q Quadtree) clear() {
q.nodes = []
}

// get_nodes recursevely returns the subdivisions the tree has.
// get_nodes recursively returns the subdivisions the tree has.
pub fn (q Quadtree) get_nodes() []Quadtree {
mut nodes := []Quadtree{}
if q.nodes.len > 0 {
Expand Down

0 comments on commit 45e13ea

Please sign in to comment.