cgma
SurfaceOverlapFacet Class Reference

#include <SurfaceOverlapFacet.hpp>

List of all members.

Public Member Functions

 SurfaceOverlapFacet (GPoint pnt[3])
 ~SurfaceOverlapFacet ()
double distance (SurfaceOverlapFacet &other_facet)
CubitBoolean facing (SurfaceOverlapFacet &other_facet)
double angle (SurfaceOverlapFacet &other_facet)
double projected_overlap (SurfaceOverlapFacet &other_facet, CubitBoolean draw_overlap=CUBIT_FALSE)
double distance_from_position (CubitVector &position)
bool facet_points_within_tol (SurfaceOverlapFacet *other_face, double tolerance)
double perimeter ()
bool bbox_overlap (double tol, SurfaceOverlapFacet &other_facet)
CubitBox bounding_box ()
void draw (int color)
CubitVector centroid ()
CubitVector smallest_edge_midpoint ()

Private Attributes

Triangle3 t
CubitBox boundingBox

Static Private Attributes

static AnalyticGeometryToolagt = AnalyticGeometryTool::instance()

Detailed Description

Definition at line 29 of file SurfaceOverlapFacet.hpp.


Constructor & Destructor Documentation

Definition at line 13 of file SurfaceOverlapFacet.cpp.

{
  t.b.x = p[0].x;
  t.b.y = p[0].y;
  t.b.z = p[0].z;

  t.e0.x = p[1].x - p[0].x;
  t.e0.y = p[1].y - p[0].y;
  t.e0.z = p[1].z - p[0].z;

  t.e1.x = p[2].x - p[0].x;
  t.e1.y = p[2].y - p[0].y;
  t.e1.z = p[2].z - p[0].z;

  CubitVector min;
   
  min.set( CUBIT_MIN_3( p[0].x, p[1].x, p[2].x ),
    CUBIT_MIN_3( p[0].y, p[1].y, p[2].y ),
    CUBIT_MIN_3( p[0].z, p[1].z, p[2].z ) );
  
  CubitVector max;
  
  max.set( CUBIT_MAX_3( p[0].x, p[1].x, p[2].x ),
    CUBIT_MAX_3( p[0].y, p[1].y, p[2].y ),
    CUBIT_MAX_3( p[0].z, p[1].z, p[2].z ) );

  boundingBox.reset( min, max );
}

Member Function Documentation

Definition at line 122 of file SurfaceOverlapFacet.cpp.

{
  return agt->Angle( t, other_facet.t ) * RADtoDEG;
}
bool SurfaceOverlapFacet::bbox_overlap ( double  tol,
SurfaceOverlapFacet other_facet 
) [inline]

Definition at line 49 of file SurfaceOverlapFacet.hpp.

  { return boundingBox.overlap( tol, other_facet.boundingBox ); }

Definition at line 52 of file SurfaceOverlapFacet.hpp.

{ return boundingBox; }

Definition at line 175 of file SurfaceOverlapFacet.cpp.

{

  CubitVector point1 = CubitVector( t.b.x, t.b.y, t.b.z );    
  CubitVector point2 = CubitVector( t.e0.x + t.b.x, 
                                    t.e0.y + t.b.y, 
                                    t.e0.z + t.b.z );    
  CubitVector point3 = CubitVector( t.e1.x + t.b.x, 
                                    t.e1.y + t.b.y, 
                                    t.e1.z + t.b.z );    

  point1 += point2;
  point1 += point3;
  point1 /= 3;
  
  return point1;
}

Definition at line 47 of file SurfaceOverlapFacet.cpp.

{
  double s, t2, u, v;
  return agt->MinTriangleTriangle( t, other_facet.t, s, t2, u, v );
}

Definition at line 93 of file SurfaceOverlapFacet.cpp.

{
  double s,t;  
  Point3 tmp_point;
  tmp_point.x = position.x();
  tmp_point.y = position.y();
  tmp_point.z = position.z();
  return agt->MinPointTriangle( tmp_point, this->t, s, t );
} 
void SurfaceOverlapFacet::draw ( int  color)

Definition at line 158 of file SurfaceOverlapFacet.cpp.

{
  CubitVector point1 = CubitVector( t.b.x, t.b.y, t.b.z );    
  CubitVector point2 = CubitVector( t.e0.x + t.b.x, 
                                    t.e0.y + t.b.y, 
                                    t.e0.z + t.b.z );    
  CubitVector point3 = CubitVector( t.e1.x + t.b.x, 
                                    t.e1.y + t.b.y, 
                                    t.e1.z + t.b.z );    

  GfxPreview::draw_line( point1, point2, color );
  GfxPreview::draw_line( point2, point3, color );
  GfxPreview::draw_line( point1, point3, color );
  
  return;
}
bool SurfaceOverlapFacet::facet_points_within_tol ( SurfaceOverlapFacet other_face,
double  tolerance 
)

Definition at line 70 of file SurfaceOverlapFacet.cpp.

{
  CubitVector tmp_pt( t.b.x, t.b.y, t.b.z );
  if( this->distance_from_position( tmp_pt ) > tolerance )
    return false;

  tmp_pt.set( t.b.x + t.e0.x,
              t.b.y + t.e0.y,
              t.b.z + t.e0.z );

  if( this->distance_from_position( tmp_pt ) > tolerance )
    return false;

  tmp_pt.set( t.b.x + t.e1.x,
              t.b.y + t.e1.y,
              t.b.z + t.e1.z );

  if( this->distance_from_position( tmp_pt ) > tolerance )
    return false;

  return true;
}

Definition at line 104 of file SurfaceOverlapFacet.cpp.

{
    double norm1[3];
    agt->Normal( t, norm1 );
    double norm2[3];
    agt->Normal( other_facet.t, norm2 );

    // move to the origin
    double o1[3];
    o1[0] = other_facet.t.b.x-t.b.x;
    o1[1] = other_facet.t.b.y-t.b.y;
    o1[2] = other_facet.t.b.z-t.b.z;

    double dot_p = agt->dot_vec(norm1,o1);
    return (CubitBoolean)(dot_p >= 0.0);
}

Definition at line 53 of file SurfaceOverlapFacet.cpp.

{
  CubitVector pt0( t.b.x, t.b.y, t.b.z );
  CubitVector pt1( t.b.x + t.e0.x,
                   t.b.y + t.e0.y,
                   t.b.z + t.e0.z );
  CubitVector pt2( t.b.x + t.e1.x,
                   t.b.y + t.e1.y,
                   t.b.z + t.e1.z ); 

  double total_dist = pt0.distance_between(pt1);
  total_dist += pt1.distance_between( pt2 );
  total_dist += pt2.distance_between( pt0 );

  return total_dist;
}

Definition at line 128 of file SurfaceOverlapFacet.cpp.

{
  double tmp_double = agt->ProjectedOverlap( t, other_facet.t, draw_overlap );

  if( tmp_double > 0.00 ) 
  {
    CubitVector edge0(t.e0.x, t.e0.y, t.e0.z);  
    CubitVector edge1(t.e1.x, t.e1.y, t.e1.z);  
    CubitVector normal = edge0 * edge1;
    double area_facet1 = normal.length() / 2;

    edge0.set(other_facet.t.e0.x, other_facet.t.e0.y, other_facet.t.e0.z);  
    edge1.set(other_facet.t.e1.x, other_facet.t.e1.y, other_facet.t.e1.z);  
    normal = edge0 * edge1;
    double area_facet2 = normal.length() / 2;
    
    //don't report overlapping area between facets unless it is greater 
    //than one hundredth of the area of the smaller facet
    if( area_facet1 < area_facet2 )
    {
      if( tmp_double < (area_facet1*0.01))
        tmp_double = 0.0;
    }
    else if( tmp_double < (area_facet2*0.01 ))
      tmp_double = 0.0;
  }
  return tmp_double;
}

Definition at line 193 of file SurfaceOverlapFacet.cpp.

{
  CubitVector point1 = CubitVector( t.b.x, t.b.y, t.b.z );    
  CubitVector point2 = CubitVector( t.e0.x + t.b.x, 
                                    t.e0.y + t.b.y, 
                                    t.e0.z + t.b.z );    
  CubitVector point3 = CubitVector( t.e1.x + t.b.x, 
                                    t.e1.y + t.b.y, 
                                    t.e1.z + t.b.z );    
  
  double len_12 = point1.distance_between( point2 );
  double len_23 = point2.distance_between( point3 );
  double len_13 = point1.distance_between( point3 );

  if( (len_12 < len_23) && (len_12 < len_13) )
  {
    point1 += point2;
    point1 /= 2;
    return point1;
  }
  else if( len_23 < len_13 )
  {
    point2 += point3;
    point2 /= 2;
    return point2;
  }
  else
  {
    point1 += point3;
    point1 /= 2;
    return point1;
  }
}

Member Data Documentation

Definition at line 63 of file SurfaceOverlapFacet.hpp.


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