示例#1
0
//----------------------------------------------------------------
// Function: reflect
// Description: reflect the body about an plane given the normal
//              vector.
//
// Author: Jane Hu
//----------------------------------------------------------------
CubitStatus OCCBody::reflect( double reflect_axis_x,
                              double reflect_axis_y,
                              double reflect_axis_z )
{
  gp_Pnt aOrigin(0,0,0);
  gp_Dir aDir(reflect_axis_x, reflect_axis_y,reflect_axis_z); 
  gp_Ax2 anAx2(aOrigin, aDir);

  gp_Trsf aTrsf;
  aTrsf.SetMirror(anAx2);

  BRepBuilderAPI_Transform aBRepTrsf(aTrsf);
  return transform(aBRepTrsf);
}
示例#2
0
//----------------------------------------------------------------
// Function: rotate
// Description: rotate the body and its child entities
//
// Author: Jane Hu
//----------------------------------------------------------------
CubitStatus OCCBody::rotate( double x, double y, double z, 
                             double angle )//in radians
{
  gp_Pnt aOrigin(0,0,0);
  gp_Dir aDir(x, y, z);
  gp_Ax1 anAxis(aOrigin, aDir);

  //a is angular value of rotation in radians
  gp_Trsf aTrsf;
  aTrsf.SetRotation(anAxis, angle);

  BRepBuilderAPI_Transform aBRepTrsf(aTrsf);

  return transform(aBRepTrsf);
}
//================================================================
// Function : Convert_Presentation::sampleCircle
// Purpose  : 
//================================================================
void Convert_Presentation::sampleCircle()
{
  gp_Pnt aOrigin (0,0,0);
  gp_Dir aDir (1,0,0);
  gp_Ax2 aAxis (aOrigin, aDir);
  Standard_Real aRadius = 300;
  Handle_Geom_Circle aCurve = new Geom_Circle (aAxis, aRadius);

  TCollection_AsciiString aText (
    "  gp_Pnt aOrigin (0,0,0);" EOL
    "  gp_Dir aDir (1,0,0);" EOL
    "  gp_Ax2 aAxis (aOrigin, aDir);" EOL
    "  Standard_Real aRadius = 300;" EOL
    "  Handle(Geom_Circle) aCurve = new Geom_Circle (aAxis, aRadius);" EOL
    );
  drawCurveAndItsBSpline (aCurve, "Circle", aText);
}
//================================================================
// Function : Convert_Presentation::sampleEllipse
// Purpose  : 
//================================================================
void Convert_Presentation::sampleEllipse()
{
  gp_Pnt aOrigin (0,0,0);
  gp_Dir aDir (1,0,0);
  gp_Ax2 aMajorAxis (aOrigin, aDir);
  Standard_Real aMajorRadius = 300;
  Standard_Real aMinorRadius = 150;
  Handle(Geom_Ellipse) aCurve = 
    new Geom_Ellipse (aMajorAxis, aMajorRadius, aMinorRadius);

  TCollection_AsciiString aText (
    "  gp_Pnt aOrigin (0,0,0);" EOL
    "  gp_Dir aDir (1,0,0);" EOL
    "  gp_Ax2 aAxis (aOrigin, aDir);" EOL
    "  Standard_Real aMajorRadius = 300;" EOL
    "  Standard_Real aMinorRadius = 150;" EOL
    "  Handle(Geom_Ellipse) aCurve = " EOL
    "    new Geom_Ellipse (aAxis, aMajorRadius, aMinorRadius);" EOL
    );
  drawCurveAndItsBSpline (aCurve, "Ellipse", aText);
}