Ejemplo n.º 1
0
toxi::geom::Triangle3D toxi::geom::Triangle3D::createEquilateralFrom( Vec3D & a, Vec3D & b )
{
    Vec3D c = a.interpolateTo( b, 0.5 );
    Vec3D dir = b.sub( a );
    Vec3D n = a.cross( dir.normalize( ) );
    c.addSelf( n.normalizeTo( dir.magnitude() * toxi::math::MathUtils::SQRT3 / 2 ) );
    return Triangle3D( a, b, c );
}
Ejemplo n.º 2
0
 // Returns the angle between two Vecs
 double angle_between(Vec3D<Type> v){
     return(atan(dot_product(v)/(magnitude() * v.magnitude())));
 }
Ejemplo n.º 3
0
 // Return the magnitude of a Vec with a direction
 // perpendicular to the plane containing this and v
 double cross_product(Vec3D<Type> v){
     return (magnitude()*v.magnitude()*sin(angle_between(v)));
 }