public static csgjs_vector negate(csgjs_vector a) { return(a * -1.0f); }
public static float dot(csgjs_vector a, csgjs_vector b) { return(a.x * b.x + a.y * b.y + a.z * b.z); }
public static csgjs_vector lerp(csgjs_vector a, csgjs_vector b, float v) { return(a + (b - a) * v); }
public csgjs_vertex(Point3d pnt) { pos = new csgjs_vector((float)pnt.x,(float)pnt.y,(float)pnt.z); normal = new csgjs_vector(); uv = new csgjs_vector(); }
public void flip() { normal = csgjs_vector.negate(normal); w *= -1.0f; }
public static csgjs_vector cross(csgjs_vector a, csgjs_vector b) { return(new csgjs_vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x)); }
public csgjs_plane(csgjs_vector a, csgjs_vector b, csgjs_vector c) { normal = csgjs_vector.unit(csgjs_vector.cross(b - a, c - a)); w = csgjs_vector.dot(normal, a); }
public static csgjs_vector cross( csgjs_vector a, csgjs_vector b) { return new csgjs_vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); }
public csgjs_vertex() { pos = new csgjs_vector(); normal = new csgjs_vector(); uv = new csgjs_vector(); }
public static float length( csgjs_vector a) { return (float)Math.Sqrt(dot(a, a)); }
public static csgjs_vector unit( csgjs_vector a) { return a / length(a); }
public static csgjs_vector negate( csgjs_vector a) { return a * -1.0f; }
public static csgjs_vector lerp( csgjs_vector a, csgjs_vector b, float v) { return a + (b - a) * v; }
public static float dot( csgjs_vector a, csgjs_vector b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
public static float length(csgjs_vector a) { return((float)Math.Sqrt(dot(a, a))); }
public csgjs_vertex(Point3d pnt) { pos = new csgjs_vector((float)pnt.x, (float)pnt.y, (float)pnt.z); normal = new csgjs_vector(); uv = new csgjs_vector(); }
public static csgjs_vector unit(csgjs_vector a) { return(a / length(a)); }
public csgjs_plane() { normal = new csgjs_vector(); w = 0.0f; }
public csgjs_plane( csgjs_vector a, csgjs_vector b, csgjs_vector c) { normal = csgjs_vector.unit(csgjs_vector.cross(b - a, c - a)); w = csgjs_vector.dot(normal, a); }