Get the project to compile once again.

This commit is contained in:
Edward R. Gonzalez 2024-05-04 11:47:21 -04:00
parent 4492ca3079
commit f27a69de9a
6 changed files with 51 additions and 37 deletions

View File

@ -108,9 +108,9 @@ add :: proc {
add_range2,
}
bivec :: proc {
bivec_from_f32s,
vec3_to_bivec,
bivec3 :: proc {
bivec3_via_f32s,
vec3_to_bivec3,
}
cm_to_pixels :: proc {
@ -149,7 +149,7 @@ get_bounds :: proc {
inverse_mag :: proc {
inverse_mag_vec3,
inverse_mag_rotor3,
// inverse_mag_rotor3,
}
is_power_of_two :: proc {
@ -191,9 +191,6 @@ pow :: proc{
}
pow2 :: proc {
math.pow2_f16,
math.pow2_f32,
math.pow2_f64,
pow2_vec3,
}
@ -208,7 +205,7 @@ push :: proc {
rotor3 :: proc {
rotor3_via_comps,
rotor3_via_s_bv,
rotor3_via_bv_s,
rotor3_via_from_to,
}
@ -255,14 +252,15 @@ to_string :: proc {
str_builder_to_string,
}
to_vec3 :: proc {
vec3 :: proc {
vec3_via_f32s,
bivec3_to_vec3,
point3_to_vec3,
pointflat3_to_vec3,
unitvec3_to_vec3,
}
to_vec4 :: proc {
vec4 :: proc {
unitvec4_to_vec4,
}

View File

@ -1,6 +1,8 @@
/*
The default arena allocator Odin provides does fragmented resizes even for the last most allocated block getting resized.
This is an alternative to alleviates that.
TODO(Ed): Implement?
*/
package sectr

View File

@ -1,6 +1,6 @@
// Based on gencpp's and thus zpl's Array implementation
// Made becasue of the map issue with fonts during hot-reload.
// I didn't want to make the HMapZPL impl with the [dynamic] array for now to isolate
// I didn't want to make the HMapZPL impl with the [dynamic] array for now to isolate the hot-reload issue (when I was diagnoising)
package sectr
import "core:c/libc"

View File

@ -7,9 +7,9 @@ not for a contiguous array of them.
Thus the free-list only tracks the last free entries thrown out by the user,
irrespective of the bucket the originated from.
This means if there is a heavy recyling of entires in a pool
there can be a large discrepancy of memory localicty of the buckets are small.
there can be a large discrepancy of memory localicty if buckets are small.
The pool doesn't allocate any buckets on initialization unless the user specifes.
The pool doesn't allocate any buckets on initialization unless the user specifies.
*/
package sectr

View File

@ -39,7 +39,9 @@ UnitBivec3 :: distinct Bivec3
//region Vec3
complement_vec3 :: #force_inline proc "contextless" ( v : Vec3 ) -> Bivec3 {return transmute(Bivec3) v}
vec3_via_f32s :: #force_inline proc "contextless" (x, y, z : f32) -> Vec3 { return {x, y, z} }
// complement_vec3 :: #force_inline proc "contextless" ( v : Vec3 ) -> Bivec3 {return transmute(Bivec3) v}
cross_vec3 :: proc "contextless" (a, b : Vec3) -> (v : Vec3) {
v = vec3( wedge(a, b))
@ -90,8 +92,9 @@ project_unitv3_v3 :: #force_inline proc "contextless" (u : UnitVec3, v : Vec3) -
return
}
// Anti-wedge of vectors
regress_vec3 :: proc "contextless" ( a, b : Vec3 ) -> f32 {
return a.x * b.y - a.y *
return a.x * b.y - a.y * b.x
}
reject_v3_unitv3 :: proc "contextless" ( v : Vec3, u : UnitVec3 ) -> ( v_from_u : Vec3) {
@ -116,9 +119,9 @@ wedge_vec3 :: proc "contextless" (a, b : Vec3) -> (bv : Bivec3) {
//endregion Vec3
//region Bivec3
bivec_from_f32s :: #force_inline proc "contextless" (yz, zx, xy : f32) -> Bivec3 {return { xyz = {yz, zx, xy} }}
bivec3_via_f32s :: #force_inline proc "contextless" (yz, zx, xy : f32) -> Bivec3 {return { xyz = {yz, zx, xy} }}
complement_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> Bivec3 {return b.xyz}
complement_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> Bivec3 {return transmute(Bivec3) b.xyz}
//region Operations isomoprhic to vectors
negate_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> Bivec3 {return transmute(Bivec3) -b.xyz}
@ -128,23 +131,30 @@ mul_bivec3 :: #force_inline proc "contextless" (a, b : Bivec3)
mul_bivec3_f32 :: #force_inline proc "contextless" (b : Bivec3, s : f32) -> Bivec3 {return transmute(Bivec3) (b.xyz * s)}
mul_f32_bivec3 :: #force_inline proc "contextless" (s : f32, b : Bivec3) -> Bivec3 {return transmute(Bivec3) (s * b.xyz)}
div_bivec3_f32 :: #force_inline proc "contextless" (b : Bivec3, s : f32) -> Bivec3 {return transmute(Bivec3) (b.xyz / s)}
inverse_mag_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return transmute(Bivec3) inverse_mag_vec3(b.xyz)}
magnitude_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return transmute(Bivec3) magnitude_vec3 (b.xyz)}
normalize_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> UnitBivec3 {return transmute(Bivec3) normalize_vec3 (b.xyz)}
squared_mag_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return transmute(Bivec3) pow_2_vec3 (b.xyz)}
inverse_mag_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return inverse_mag_vec3(b.xyz)}
magnitude_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return magnitude_vec3 (b.xyz)}
normalize_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> UnitBivec3 {return transmute(UnitBivec3) normalize_vec3(b.xyz)}
squared_mag_bivec3 :: #force_inline proc "contextless" (b : Bivec3) -> f32 {return pow2_vec3(b.xyz)}
//endregion Operations isomoprhic to vectors
// The wedge of a bi-vector in 3D vector space results in a Trivector represented as a scalar.
// This scalar usually resolves to zero with six possible exceptions that lead to the negative volume element.
wedge_bivec3 :: proc ( a, b : Bivec3 ) -> f32 {
s := a.yz + b.yz + a.zx + b.zx + a.xy + b.xy
return s
}
// anti-wedge (Combines dimensions that are absent from a & b)
regress_bivec3 :: #force_inline proc "contextless" ( a, b : Bivec3 ) -> Vec3 {return wedge(vec3(a), vec3(b))}
// regress_bivec3_v :: #force_inline proc "contextless" (b : Bivec3, v : Vec3) -> f32 {return regress(b.xyz, v)}
// regress_v3_bivec3 :: #force_inline proc "contextless" (v : Vec3, b : Bivec3) -> f32 {return regress(b.xyz, v)}
regress_bivec3 :: #force_inline proc "contextless" ( a, b : Bivec3 ) -> Vec3 {return wedge_vec3(vec3(a), vec3(b))}
regress_bivec3_v :: #force_inline proc "contextless" (b : Bivec3, v : Vec3) -> f32 {return regress_vec3(b.xyz, v)}
regress_v3_bivec3 :: #force_inline proc "contextless" (v : Vec3, b : Bivec3) -> f32 {return regress_vec3(b.xyz, v)}
//endregion Bivec3
//region Rotor3
rotor3_via_comps :: proc "contextless" (yz, zx, xy, scalar : f32) -> (rotor : Rotor3) {
rotor = Rotor3 {bivec(yz, zx, xy), scalar}
rotor = Rotor3 {bivec3_via_f32s(yz, zx, xy), scalar}
return
}
@ -171,7 +181,7 @@ squared_mag :: proc "contextless" (rotor : Rotor3) -> (s : f32) {
}
reverse_rotor3 :: proc "contextless" (rotor : Rotor3) -> (reversed : Rotor3) {
reversed = { negate(rotor.bv), rotor.s }
reversed = { negate_bivec3(rotor.bv), rotor.s }
return
}
@ -190,20 +200,24 @@ Plane3 :: distinct Vec4 // 4D Anti-vector
// aka: wedge operation for points
join_point3 :: proc "contextless" (p, q : Point3) -> (l : Line3) {
weight := sub(q, p)
bulk := wedge(to_vec3(p), to_vec3(q))
l = {weight, bulk}
return
}
join_pointflat3 :: proc "contextless" (p, q : PointFlat3) -> (l : Line3) {
weight := p.w * q - p * q.w
bulk := wedge(vec3(p), vec3(q))
l = {weight, bulk}
return
}
join_pointflat3 :: proc "contextless" (p, q : PointFlat3) -> (l : Line3) {
weight := vec3(
p.w * q.x - p.x * q.w,
p.w * q.y - p.y * q.w,
p.w * q.z - p.z * q.w
)
bulk := wedge(vec3(p), vec3(q))
l = { weight, bulk}
return
}
sub_point3 :: proc "contextless" (a, b : Point3) -> (v : Vec3) {
v = to_vec3(a) - to_vec3(b)
v = vec3(a) - vec3(b)
return
}

View File

@ -1,15 +1,15 @@
package sectr
// A dump of equivalent symbol generatioon (because the toolchain can't do it)
// A dump of equivalent symbol generatioon (because the toolchain can't do it yet)
// Symbol alias tables are in grim.odin
vec3_to_bivec :: #force_inline proc "contextless" (v : Vec3) -> Bivec3 {return transmute(Bivec3) v }
vec3_to_bivec3 :: #force_inline proc "contextless" (v : Vec3) -> Bivec3 {return transmute(Bivec3) v }
bivec3_to_vec3 :: #force_inline proc "contextless" (bv : Bivec3) -> Vec3 {return transmute(Vec3) bv }
rotor3_to_quat128 :: #force_inline proc "contextless" (rotor : Rotor3) -> Quat128 {return transmute(Quat128) rotor}
unitvec3_to_vec3 :: #force_inline proc "contextless" (v : UnitVec3) -> Vec3 {return transmute(Vec3) v }
unitvec4_to_vec4 :: #force_inline proc "contextless" (v : UnitVec4) -> Vec4 {return transmute(Vec4) v }
plane_to_vec4 :: #force_inline proc "contextless" (p : Plane3) -> Vec4 {return transmute(Vec4) p}
// plane_to_vec4 :: #force_inline proc "contextless" (p : Plane3) -> Vec4 {return transmute(Vec4) p}
point3_to_vec3 :: #force_inline proc "contextless" (p : Point3) -> Vec3 {return transmute(Vec3) p}
pointflat3_to_vec3 :: #force_inline proc "contextless" (p : PointFlat3) -> Vec3 {return { p.x, p.y, p.z }}
vec3_to_point3 :: #force_inline proc "contextless" (v : Vec3) -> Point3 {return transmute(Point3) v}