cgma
ParamCubitPlane Class Reference

#include <ParamCubitPlane.hpp>

Inheritance diagram for ParamCubitPlane:
CubitPlane

List of all members.

Public Member Functions

 ParamCubitPlane (const CubitVector &zero_position, const CubitVector &u_direction, const CubitVector &v_direction, CubitStatus &result)
 ParamCubitPlane (const ParamCubitPlane &copy_this)
 ParamCubitPlane (double A, double B, double C, double D)
 ParamCubitPlane (const CubitVector &normal, double D)
 ParamCubitPlane (const CubitVector &normal, const CubitVector &point)
 ParamCubitPlane (DLIList< CubitVector * > &positions)
 ParamCubitPlane (const CubitPlane &copy_this)
CubitStatus closest_point (const CubitVector &position, CubitVector &closest_position) const
CubitStatus move_to_plane (CubitVector &position) const

Private Member Functions

void make_parameterization ()

Private Attributes

CubitVector p_
CubitVector s_
CubitVector t_
CubitBoolean is_plane_valid_
CubitVector n_
double n_epsilon_

Detailed Description

Definition at line 22 of file ParamCubitPlane.hpp.


Constructor & Destructor Documentation

ParamCubitPlane::ParamCubitPlane ( const CubitVector zero_position,
const CubitVector u_direction,
const CubitVector v_direction,
CubitStatus result 
)

Definition at line 27 of file ParamCubitPlane.cpp.

{
    if( mk_plane_with_points( zero_position, zero_position + u_direction, 
        zero_position + v_direction ) == (int)CUBIT_SUCCESS )
    {
        is_plane_valid_= CUBIT_TRUE;
        result = CUBIT_SUCCESS;
    }
    else
    {
        is_plane_valid_= CUBIT_FALSE;
        result = CUBIT_FAILURE;
        return ;
    }
    
    p_ = zero_position;
    s_ = u_direction;
    t_ = v_direction;
    n_ = s_ * t_;
    
    double n_len = n_.length();
    if( 1000 * CUBIT_DBL_MIN > n_len ) n_epsilon_ = CUBIT_DBL_MIN;
    else n_epsilon_ = n_len / 1000;
}
ParamCubitPlane::ParamCubitPlane ( double  A,
double  B,
double  C,
double  D 
)
ParamCubitPlane::ParamCubitPlane ( const CubitVector normal,
double  D 
)
ParamCubitPlane::ParamCubitPlane ( const CubitVector normal,
const CubitVector point 
)

Member Function Documentation

CubitStatus ParamCubitPlane::closest_point ( const CubitVector position,
CubitVector closest_position 
) const

Definition at line 65 of file ParamCubitPlane.cpp.

{
    assert( is_plane_valid_);
    if( !is_plane_valid_) return CUBIT_FAILURE;

    closest_position = position - (normal() * distance(position));
    return CUBIT_SUCCESS;
}

Definition at line 100 of file ParamCubitPlane.cpp.

{
    //Choose the zero-point for the parameterization
    //as close to the origin as possible.
//  p_.set( 0.0, 0.0, 0.0);
//  move_to_plane( p_ );
    is_plane_valid_ = CUBIT_TRUE;
    
    const CubitVector temp_p(0.0, 0.0, 0.0);
    CubitStatus s = closest_point( temp_p, p_ );
    assert( s == CUBIT_SUCCESS );
    if (CUBIT_SUCCESS != s) {
      PRINT_ERROR("ParamCubitPlane::closest_point failed.\n");
      return;
    }
    
    CubitVector n = normal();
    CubitVector p1;
    
    p1 = p_;
    double x = fabs( n.x() );
    double y = fabs( n.y() );
    double z = fabs( n.z() );
    
    //Choose a direction from the zero point (p_) for
    //the second point as the direction of the smallest
    //component of the normal.  The third point defining
    //the plane will be defined by the cross product of
    //the vector from the zero_point to this point and
    //the normal vector of the plane.
    if( (x <= y) && (x <= z) )
    {
        p1.x( p1.x() + 1 );
    }
    else if( (y <= x) && (y <= z) )
    {
        p1.y( p1.y() + 1 );
    }
    else
    {
        p1.z( p1.z() + 1 );
    }
    
    move_to_plane( p1 );
    s_ = p1 - p_;
    t_ = -(s_ * n);
    n_ = s_ * t_;
    
    double n_len = n_.length();
    if( 1000 * CUBIT_DBL_MIN > n_len ) n_epsilon_ = CUBIT_DBL_MIN;
    else n_epsilon_ = n_len / 1000;
    
 
    is_plane_valid_= CUBIT_TRUE;
}

Definition at line 84 of file ParamCubitPlane.cpp.

{
    const CubitVector v = position;
    CubitStatus s = closest_point( v, position );
    return s;
}       

Member Data Documentation

Definition at line 89 of file ParamCubitPlane.hpp.

double ParamCubitPlane::n_epsilon_ [private]

Definition at line 90 of file ParamCubitPlane.hpp.

Definition at line 87 of file ParamCubitPlane.hpp.

Definition at line 87 of file ParamCubitPlane.hpp.

Definition at line 87 of file ParamCubitPlane.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines