/*-------------------------------------------------------------------------*
	* Dual                                                                    *
	*                                                                         *
	* Construct the dual triangle of the current triangle, which is another   *
	* spherical triangle.                                                     *
	*                                                                         *
	*-------------------------------------------------------------------------*/
	SphericalTriangle SphericalTriangle::Dual() const
	{
		Vec3 dual_A = B() ^ C();  if( dual_A * A() < 0.0 ) dual_A *= -1.0;
		Vec3 dual_B = A() ^ C();  if( dual_B * B() < 0.0 ) dual_B *= -1.0;
		Vec3 dual_C = A() ^ B();  if( dual_C * C() < 0.0 ) dual_C *= -1.0;
		return SphericalTriangle( dual_A, dual_B, dual_C );
	}
Example #2
0
/*-------------------------------------------------------------------------*
 * Dual                                                                    *
 *                                                                         *
 * Construct the dual triangle of the current triangle, which is another   *
 * spherical triangle.                                                     *
 *                                                                         *
 *-------------------------------------------------------------------------*/
    SphericalTriangle SphericalTriangle::Dual() const
    {
        Vector3d dual_A = B() ^ C();  if( dual_A * A() < 0.0 ) dual_A = -1.0 * dual_A ;
        Vector3d dual_B = A() ^ C();  if( dual_B * B() < 0.0 ) dual_B = -1.0 * dual_B ;
        Vector3d dual_C = A() ^ B();  if( dual_C * C() < 0.0 ) dual_C = -1.0 * dual_C ;
        return SphericalTriangle( dual_A, dual_B, dual_C );
    }
	/*-------------------------------------------------------------------------*
	* New_Alpha                                                               *
	*                                                                         *
	* Returns a new spherical triangle derived from the original one by       *
	* moving the "C" vertex along the edge "BC" until the new "alpha" angle   *
	* equals the given argument.                                              *
	*                                                                         *
	*-------------------------------------------------------------------------*/
	SphericalTriangle SphericalTriangle::New_Alpha( float alpha ) const
	{
		Vec3 V1( A() ), V2( B() ), V3( C() );
		Vec3 E1 = Unit( V2 ^ V1 );
		Vec3 E2 = E1 ^ V1;
		Vec3 G  = ( cos(alpha) * E1 ) + ( sin(alpha) * E2 );
		Vec3 D  = Unit( V3 / V2 );
		Vec3 C2 = ((G * D) * V2) - ((G * V2) * D);
		if( Triple( V1, V2, C2 ) > 0.0 ) C2 *= -1.0;
		return SphericalTriangle( V1, V2, C2 );
	}
Example #4
0
/*-------------------------------------------------------------------------*
 * New_Alpha                                                               *
 *                                                                         *
 * Returns a new spherical triangle derived from the original one by       *
 * moving the "C" vertex along the edge "BC" until the new "alpha" angle   *
 * equals the given argument.                                              *
 *                                                                         *
 *-------------------------------------------------------------------------*/
    SphericalTriangle SphericalTriangle::New_Alpha( double alpha ) const
    {
        Vector3d V1( A() ), V2( B() ), V3( C() );
        Vector3d E1 = Unit( V2 ^ V1 );
        Vector3d E2 = E1 ^ V1;
        Vector3d G  = ( cos(alpha) * E1 ) + ( sin(alpha) * E2 );
        Vector3d D  = Unit( V3 / V2 );
        Vector3d C2 = ((G * D) * V2) - ((G * V2) * D);
        if( Triple( V1, V2, C2 ) > 0.0 ) C2 = -1.0 * C2 ;
        return SphericalTriangle( V1, V2, C2 );
    }