cgma
ConeSurface Class Reference
Inheritance diagram for ConeSurface:
SurfaceVolume

List of all members.

Public Member Functions

 ConeSurface (axis_t axis_p, double tsquared_p, double point_p, double nappe_p)
 ConeSurface (axis_t axis_p, double tsquared_p, Vector3d center_p, double nappe_p)
virtual double getFarthestExtentFromOrigin () const

Protected Types

enum  nappe { LEFT = -1, BOTH = 0, RIGHT = 1 }

Protected Member Functions

virtual iBase_EntityHandle getHandle (bool positive, iGeom_Instance &igm, double world_size)

Static Protected Member Functions

static enum nappe make_nappe (double param)

Protected Attributes

axis_t axis
double theta
Vector3d center
 the cone's opening angle
bool onaxis
 the cone's apex
enum nappe nappe

Detailed Description

Definition at line 226 of file volumes.cpp.


Member Enumeration Documentation

enum ConeSurface::nappe [protected]
Enumerator:
LEFT 
BOTH 
RIGHT 

Definition at line 230 of file volumes.cpp.

{LEFT=-1, BOTH=0, RIGHT=1};

Constructor & Destructor Documentation

ConeSurface::ConeSurface ( axis_t  axis_p,
double  tsquared_p,
double  point_p,
double  nappe_p 
) [inline]

Definition at line 252 of file volumes.cpp.

                                                                                 :
    SurfaceVolume(), axis(axis_p), theta( atan(sqrt(tsquared_p)) ), center(origin), onaxis(true), nappe(make_nappe(nappe_p))
  {
    center.v[axis] = point_p; 
  }
ConeSurface::ConeSurface ( axis_t  axis_p,
double  tsquared_p,
Vector3d  center_p,
double  nappe_p 
) [inline]

Definition at line 258 of file volumes.cpp.

                                                                                    :
    SurfaceVolume(), axis(axis_p), theta( atan(sqrt(tsquared_p)) ), center(center_p), onaxis(false), nappe(make_nappe(nappe_p))
  {}

Member Function Documentation

virtual double ConeSurface::getFarthestExtentFromOrigin ( ) const [inline, virtual]

Implements SurfaceVolume.

Definition at line 262 of file volumes.cpp.

                                                     {
    return sqrt(3) + ( center.length() );
  }
virtual iBase_EntityHandle ConeSurface::getHandle ( bool  positive,
iGeom_Instance igm,
double  world_size 
) [inline, protected, virtual]

Implements SurfaceVolume.

Definition at line 267 of file volumes.cpp.

                                                                                               {

    double height = (center.length() + world_size);

    // based on the textual descriptions in the manual, I think the following expression should be 
    // height * tan ( theta / 2 ) -- unless "opening angle" refers to only half the apex angle
    // of the cylinder.  But this implementation seems to be more correct in examples I can check against.
    double base_radius = height * tan( theta );

    int igm_result;

    iBase_EntityHandle right_nappe = 0;
    iBase_EntityHandle left_nappe = 0;
    iBase_EntityHandle cone; 
    
    if( nappe != LEFT){
      iGeom_createCone( igm, height, base_radius, 0, 0, &right_nappe, &igm_result);
      CHECK_IGEOM( igm_result, "making cone (right nappe)" );
      iGeom_rotateEnt( igm, right_nappe, 180, 1, 0, 0, &igm_result);
      CHECK_IGEOM( igm_result, "Rotating cone (right nappe)");
      iGeom_moveEnt( igm, right_nappe, 0, 0, height/2.0, &igm_result );
      CHECK_IGEOM( igm_result, "Moving cone (right nappe)");      
      cone = right_nappe;
    }
    if( nappe != RIGHT ){
      iGeom_createCone( igm, height, base_radius, 0, 0, &left_nappe, &igm_result );
      CHECK_IGEOM( igm_result, "making cone (left nappe)" );
      iGeom_moveEnt( igm, left_nappe, 0, 0, -height/2.0, &igm_result );
      CHECK_IGEOM( igm_result, "Moving cone (left nappe)" );
      cone = left_nappe;
    }

    
    if( right_nappe && left_nappe ){
      iBase_EntityHandle nappes[2] = {right_nappe, left_nappe};
      iGeom_uniteEnts( igm, nappes, 2, &cone, &igm_result );
      CHECK_IGEOM( igm_result, "Unioning cone nappes" );
    }

    if( axis == X ){
      iGeom_rotateEnt( igm, cone, 90, 0, 1, 0, &igm_result );
      CHECK_IGEOM( igm_result, "rotating cone (X)" );
    }
    else if( axis == Y ){
      iGeom_rotateEnt( igm, cone, -90, 1, 0, 0, &igm_result );
      CHECK_IGEOM( igm_result, "rotating cone (Y)" );
    }

    iGeom_moveEnt( igm, cone, center.v[0], center.v[1], center.v[2], &igm_result);
    CHECK_IGEOM( igm_result, "moving cone to its apex" );

    iBase_EntityHandle final_cone = embedWithinWorld( positive, igm, world_size, cone, true );

    return final_cone;

    }
static enum nappe ConeSurface::make_nappe ( double  param) [inline, static, protected]

Definition at line 232 of file volumes.cpp.

                                              {
    
    enum nappe n = static_cast<enum nappe>(param);
    if( -1 <= n && n <= 1 ){
      return n;
    }
    else{
      std::cerr << "WARNING: Bad cylinder +/-1 argument: " << param << std::endl;
      std::cerr << "         will pretend it was really 0" << std::endl;
      return BOTH;
    }
  }

Member Data Documentation

Definition at line 245 of file volumes.cpp.

the cone's opening angle

Definition at line 247 of file volumes.cpp.

enum nappe ConeSurface::nappe [protected]

Definition at line 249 of file volumes.cpp.

bool ConeSurface::onaxis [protected]

the cone's apex

Definition at line 248 of file volumes.cpp.

double ConeSurface::theta [protected]

Definition at line 246 of file volumes.cpp.


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