datatypes,examples: fix typos, and silence notice in the quadtree example (#20577)

This commit is contained in:
Pierre Curto 2024-01-18 14:31:42 +01:00 committed by GitHub
parent 9c7e3707b6
commit 45e13ea02a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -112,7 +112,7 @@ fn (mut app App) find_particles() {
fn main() { fn main() {
mut app := &App{ mut app := &App{
gg: 0 gg: unsafe { nil }
} }
app.gg = gg.new_context( app.gg = gg.new_context(
bg_color: gx.white bg_color: gx.white

View file

@ -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) { pub fn (mut q Quadtree) insert(p AABB) {
mut indexes := []int{} mut indexes := []int{}
@ -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 { pub fn (mut q Quadtree) retrieve(p AABB) []AABB {
mut indexes := q.get_index(p) mut indexes := q.get_index(p)
mut detected_particles := q.particles.clone() mut detected_particles := q.particles.clone()
@ -77,7 +77,7 @@ pub fn (mut q Quadtree) retrieve(p AABB) []AABB {
return detected_particles 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() { pub fn (mut q Quadtree) clear() {
q.particles = [] q.particles = []
for j in 0 .. q.nodes.len { for j in 0 .. q.nodes.len {
@ -88,7 +88,7 @@ pub fn (mut q Quadtree) clear() {
q.nodes = [] 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 { pub fn (q Quadtree) get_nodes() []Quadtree {
mut nodes := []Quadtree{} mut nodes := []Quadtree{}
if q.nodes.len > 0 { if q.nodes.len > 0 {