当前位置: 首页>>代码示例>>C++>>正文


C++ gp_Pnt类代码示例

本文整理汇总了C++中gp_Pnt的典型用法代码示例。如果您正苦于以下问题:C++ gp_Pnt类的具体用法?C++ gp_Pnt怎么用?C++ gp_Pnt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了gp_Pnt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: origin

std::list<gp_Pnt> VectorFont::Glyph::GlyphArc::Interpolate(const gp_Pnt & location, const unsigned int number_of_points ) const
{
	std::list<gp_Pnt> points;

	gp_Pnt origin(location);
	origin.SetX( origin.X() + m_xcentre );
	origin.SetY( origin.Y() + m_ycentre );

	double start_angle = m_start_angle;
	double end_angle = m_end_angle;

	if (start_angle > end_angle)
	{
		end_angle += (2 * M_PI);
	}

	double increment = (end_angle - start_angle) / number_of_points;

	gp_Dir z_direction( 0, 0, 1 );
	for (double angle = start_angle; angle <= end_angle; angle += increment)
	{
		gp_Pnt point( location.X() + m_xcentre + m_radius, location.Y() + m_ycentre, location.Z() );
		gp_Trsf rotation_matrix;
		rotation_matrix.SetRotation( gp_Ax1(origin, z_direction), angle );
		point.Transform(rotation_matrix);
		points.push_back(point);
	}

	return(points);
}
开发者ID:Blokkendoos,项目名称:heekscad,代码行数:30,代码来源:CxfFont.cpp

示例2: SetTopStopPos

void CGuideRectODL::SetTopStopPos( gp_Pnt ptStop )
{
	SetIsTopCreating(false);
	CBaseODL::SetTopStopPos(ptStop);
	m_rtArea.Width = static_cast<Gdiplus::REAL>(abs(m_ptTopStart.X() - ptStop.X()));
	m_rtArea.Height = static_cast<Gdiplus::REAL>(abs(m_ptTopStart.Z() - ptStop.Z()));
}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:7,代码来源:GuideRectODL.cpp

示例3: SetTopStartPos

void CGuideRectODL::SetTopStartPos( gp_Pnt ptStart )
{
	SetIsTopCreating(true);
	CBaseODL::SetTopStartPos(ptStart);
	m_rtArea.X= static_cast<Gdiplus::REAL>(ptStart.X());
	m_rtArea.Y = static_cast<Gdiplus::REAL>(ptStart.Z());
}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:7,代码来源:GuideRectODL.cpp

示例4: gPntTopoint3D

point3D gPntTopoint3D(gp_Pnt& p)
{ 
   point3D result;
   result.x = p.X();
   result.y = p.Y();
   result.z = p.Z();
   return result;
}
开发者ID:DevJohan,项目名称:FreeCAD_sf_master,代码行数:8,代码来源:ImpExpDxf.cpp

示例5: projectShape

//!set up a hidden line remover and project a shape with it
void GeometryObject::projectShape(const TopoDS_Shape& input,
                             const gp_Pnt& inputCenter,
                             const Base::Vector3d& direction)
{
    // Clear previous Geometry
    clear();
    Base::Vector3d origin(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
    gp_Ax2 viewAxis = getViewAxis(origin,direction);
    auto start = chrono::high_resolution_clock::now();

    Handle_HLRBRep_Algo brep_hlr = NULL;
    try {
        brep_hlr = new HLRBRep_Algo();
        brep_hlr->Add(input, m_isoCount);
        HLRAlgo_Projector projector( viewAxis );
        brep_hlr->Projector(projector);
        brep_hlr->Update();
        brep_hlr->Hide();
    }
    catch (...) {
        Standard_Failure::Raise("GeometryObject::projectShape - error occurred while projecting shape");
    }
    auto end   = chrono::high_resolution_clock::now();
    auto diff  = end - start;
    double diffOut = chrono::duration <double, milli> (diff).count();
    Base::Console().Log("TIMING - %s GO spent: %.3f millisecs in HLRBRep_Algo & co\n",m_parentName.c_str(),diffOut);

    try {
        HLRBRep_HLRToShape hlrToShape(brep_hlr);

        visHard    = hlrToShape.VCompound();
        visSmooth  = hlrToShape.Rg1LineVCompound();
        visSeam    = hlrToShape.RgNLineVCompound();
        visOutline = hlrToShape.OutLineVCompound();
        visIso     = hlrToShape.IsoLineVCompound();
        hidHard    = hlrToShape.HCompound();
        hidSmooth  = hlrToShape.Rg1LineHCompound();
        hidSeam    = hlrToShape.RgNLineHCompound();
        hidOutline = hlrToShape.OutLineHCompound();
        hidIso     = hlrToShape.IsoLineHCompound();

//need these 3d curves to prevent "zero edges" later
        BRepLib::BuildCurves3d(visHard);
        BRepLib::BuildCurves3d(visSmooth);
        BRepLib::BuildCurves3d(visSeam);
        BRepLib::BuildCurves3d(visOutline);
        BRepLib::BuildCurves3d(visIso);
        BRepLib::BuildCurves3d(hidHard);
        BRepLib::BuildCurves3d(hidSmooth);
        BRepLib::BuildCurves3d(hidSeam);
        BRepLib::BuildCurves3d(hidOutline);
        BRepLib::BuildCurves3d(hidIso);
    }
    catch (...) {
        Standard_Failure::Raise("GeometryObject::projectShape - error occurred while extracting edges");
    }

}
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:59,代码来源:GeometryObject.cpp

示例6: MyAngle

ISession_Text::ISession_Text
                 (const TCollection_AsciiString& aText, 
                  gp_Pnt&                        aPoint,
                  const Quantity_PlaneAngle      anAngle,     // = 0.0
                  const Standard_Real            aslant,      // = 0.0
                  const Standard_Integer         aColorIndex, // = 0
                  const Standard_Integer         aFontIndex,  // = 1
                  const Quantity_Factor          aScale)      // = 1
                  :AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()),
                  MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
                  MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{}
开发者ID:DLR-SC,项目名称:tigl,代码行数:12,代码来源:ISession_Text.cpp

示例7: pt

void CSkyODL::OnTopMoving(const gp_Pnt& stInfo)
{
	CBaseODL::OnTopMoving(stInfo);
	m_arrMovingTopPoint.clear();
	//修改所有点的最终位置
	for (auto& curPnt : m_arrTopPoint)
	{
		gp_Pnt pt(curPnt.X() + stInfo.X(), 
			curPnt.Y() + stInfo.Y(),
			curPnt.Z() + stInfo.Z()
			);
		m_arrMovingTopPoint.push_back(pt);
	}
}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:14,代码来源:SkyODL.cpp

示例8: from

void VectorFont::Glyph::GlyphLine::glCommands(
	const gp_Pnt & starting_point,
	const bool select,
	const bool marked,
	const bool no_color,
	COrientationModifier *pOrientationModifier,
	gp_Trsf transformation,
	const float width ) const
{
	gp_Pnt from( starting_point );
	gp_Pnt to( starting_point );

    from.SetX( starting_point.X() + m_x1);
	from.SetY( starting_point.Y() + m_y1);
	from.SetZ( starting_point.Z() );

	to.SetX( starting_point.X() + m_x2);
	to.SetY( starting_point.Y() + m_y2);
	to.SetZ( starting_point.Z() );

	if (pOrientationModifier)
	{
	    from = pOrientationModifier->Transform(transformation, starting_point.Distance(gp_Pnt(0.0,0.0,0.0)), from, width );
	    to = pOrientationModifier->Transform(transformation, starting_point.Distance(gp_Pnt(0.0,0.0,0.0)), to, width );
	}

	glBegin(GL_LINE_STRIP);
	glVertex3d(from.X(), from.Y(), from.Z());
	glVertex3d(to.X(), to.Y(), to.Z());
	glEnd();
} // End glCommands() method
开发者ID:Blokkendoos,项目名称:heekscad,代码行数:31,代码来源:CxfFont.cpp

示例9: Compute

  // -----------------------------------------------------------------------------
  bool Compute( vector< double > &                  positions,
                gp_Pnt                              pIn,
                gp_Pnt                              pOut,
                SMESH_Mesh&                         aMesh,
                const StdMeshers_LayerDistribution* hyp)
  {
    double len = pIn.Distance( pOut );
    if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells");

    if ( !hyp || !hyp->GetLayerDistribution() )
      return error( "Invalid LayerDistribution hypothesis");
    myUsedHyps.clear();
    myUsedHyps.push_back( hyp->GetLayerDistribution() );

    TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut );
    SMESH_Hypothesis::Hypothesis_Status aStatus;
    if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus ))
      return error( "StdMeshers_Regular_1D::CheckHypothesis() failed "
                    "with LayerDistribution hypothesis");

    BRepAdaptor_Curve C3D(edge);
    double f = C3D.FirstParameter(), l = C3D.LastParameter();
    list< double > params;
    if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false ))
      return error("StdMeshers_Regular_1D failed to compute layers distribution");

    positions.clear();
    positions.reserve( params.size() );
    for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++)
      positions.push_back( *itU / len );
    return true;
  }
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:33,代码来源:StdMeshers_RadialPrism_3D.cpp

示例10: FindBestPoint

//=======================================================================
//function : FindBestPoint
//purpose  : Auxilare for Compute()
//           V - normal to (P1,P2,PC)
//=======================================================================
static gp_Pnt FindBestPoint(const gp_Pnt& P1, const gp_Pnt& P2,
                            const gp_Pnt& PC, const gp_Vec& V)
{
  double a = P1.Distance(P2);
  double b = P1.Distance(PC);
  double c = P2.Distance(PC);
  if( a < (b+c)/2 )
    return PC;
  else {
    // find shift along V in order to a became equal to (b+c)/2
    double shift = sqrt( a*a + (b*b-c*c)*(b*b-c*c)/16/a/a - (b*b+c*c)/2 );
    gp_Dir aDir(V);
    gp_Pnt Pbest( PC.X() + aDir.X()*shift,  PC.Y() + aDir.Y()*shift,
                  PC.Z() + aDir.Z()*shift );
    return Pbest;
  }
}
开发者ID:dbarbier,项目名称:pythonocc,代码行数:22,代码来源:StdMeshers_QuadToTriaAdaptor.cpp

示例11: gp_PntEqual

bool ImpExpDxfWrite::gp_PntEqual(gp_Pnt p1, gp_Pnt p2) 
{
    bool result = false;
    if (p1.IsEqual(p2,Precision::Confusion())) {
        result = true;
    }
    return result;
}
开发者ID:DevJohan,项目名称:FreeCAD_sf_master,代码行数:8,代码来源:ImpExpDxf.cpp

示例12: transform_for_cone_and_depth

void transform_for_cone_and_depth(gp_Pnt &p)
{
	gp_Vec v(p.XYZ());
	double radius_beyond_surface = v.Magnitude() - pitch_radius;
	v.Normalize();

	double scale = 1.0 - cone_sin_for_point * height_for_point / pitch_radius;

	p = gp_Pnt(v.XYZ() * (scale * pitch_radius + scale * radius_beyond_surface * cone_cos_for_point)
		+ gp_XYZ(0.0, 0.0, height_for_point * cone_cos_for_point + scale * radius_beyond_surface * cone_sin_for_point));
}
开发者ID:play113,项目名称:swer,代码行数:11,代码来源:HGear.cpp

示例13: Intersects

bool HLine::Intersects(const gp_Pnt &pnt)const
{
	gp_Lin this_line = GetLine();
	if(!intersect(pnt, this_line))return false;

	// check it lies between A and B
	gp_Vec v = this_line.Direction();
	double dpA = gp_Vec(A->m_p.XYZ()) * v;
	double dpB = gp_Vec(B->m_p.XYZ()) * v;
	double dp = gp_Vec(pnt.XYZ()) * v;
	return dp >= dpA - wxGetApp().m_geom_tol && dp <= dpB + wxGetApp().m_geom_tol;
}
开发者ID:CarlosGS,项目名称:heekscad,代码行数:12,代码来源:HLine.cpp

示例14: GetIsOn

bool CTiglAbstractGeometricComponent::GetIsOn(const gp_Pnt& pnt) 
{
    const TopoDS_Shape& segmentShape = GetLoft()->Shape();

    // fast check with bounding box
    Bnd_Box boundingBox;
    BRepBndLib::Add(segmentShape, boundingBox);

    Standard_Real xmin, xmax, ymin, ymax, zmin, zmax;
    boundingBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);

    if (pnt.X() < xmin || pnt.X() > xmax ||
        pnt.Y() < ymin || pnt.Y() > ymax ||
        pnt.Z() < zmin || pnt.Z() > zmax) {

        return false;
    }

    double tolerance = 0.03; // 3cm

    BRepClass3d_SolidClassifier classifier;
    classifier.Load(segmentShape);
    classifier.Perform(pnt, tolerance);
    if ((classifier.State() == TopAbs_IN) || (classifier.State() == TopAbs_ON)) {
        return true;
    }
    else {
        return false;
    }
}
开发者ID:hyper123,项目名称:tigl,代码行数:30,代码来源:CTiglAbstractGeometricComponent.cpp

示例15: text_top_left

void HDimension::RenderText(const wxString &text, const gp_Pnt& p, const gp_Dir& xdir, const gp_Dir& ydir, double scale)
{
	float width, height;
	if(!wxGetApp().get_text_size(text, &width, &height))return;

	// make a matrix at top left of text
	gp_Pnt text_top_left( p.XYZ() + ydir.XYZ() * (scale * height) );
	gp_Trsf text_matrix = make_matrix(text_top_left, xdir, ydir);

	glPushMatrix();
	double m[16];
	extract_transposed(text_matrix, m);
	glMultMatrixd(m);

	if(DrawFlat)
	{
		//Try and draw this ortho.  must find the origin point in screen coordinates
		double x, y, z;

		// arrays to hold matrix information

		double model_view[16];
		glGetDoublev(GL_MODELVIEW_MATRIX, model_view);

		double projection[16];
		glGetDoublev(GL_PROJECTION_MATRIX, projection);

		int viewport[4];
		glGetIntegerv(GL_VIEWPORT, viewport);

		// get 3D coordinates based on window coordinates

		gluProject(0,0,0,
			model_view, projection, viewport,
			&x, &y, &z);

		wxGetApp().render_screen_text_at(text, scale*8,x,y,atan2(xdir.Y(),xdir.X()) * 180 / M_PI);
	}
	else
	{
		wxGetApp().render_text(text);
	}

	glPopMatrix();

}
开发者ID:CarlosGS,项目名称:heekscad,代码行数:46,代码来源:HDimension.cpp


注:本文中的gp_Pnt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。