a[1][1] = c;
}
+static inline void m2x2_mulv( m2x2f m, v2f v, v2f d )
+{
+ v2f res;
+
+ res[0] = m[0][0]*v[0] + m[1][0]*v[1];
+ res[1] = m[0][1]*v[0] + m[1][1]*v[1];
+
+ v2_copy( res, d );
+}
+
/*
* -----------------------------------------------------------------------------
* Section 4.b 3x3 matrices
static int plane_segment( v4f plane, v3f a, v3f b, v3f co )
{
f32 d0 = v3_dot( a, plane ) - plane[3],
- d1 = v3_dot( b, plane ) - plane[3];
+ d1 = v3_dot( b, plane ) - plane[3];
if( d0*d1 < 0.0f )
{
;
}
+static f32 ray_plane( v4f plane, v3f co, v3f dir ){
+ f32 d = v3_dot( plane, dir );
+ if( fabsf(d) > 1e-6f ){
+ v3f v0;
+ v3_muls( plane, plane[3], v0 );
+ v3_sub( v0, co, v0 );
+ return v3_dot( v0, plane ) / d;
+ }
+ else return INFINITY;
+}
+
/*
* -----------------------------------------------------------------------------
* Section 5.c Closest point functions