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


C++ gp_Pnt::Distance方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: GetXatU

FastArc::FastArc(gp_Pnt A,gp_Pnt B, gp_Pnt C, bool cw, gp_Circ circ)
{
	if(!cw)
	{
		gp_Pnt temp = A;
		A = B;
		B = temp;
		circ.SetAxis(circ.Axis().Reversed());
	}


	this->A = A;
	this->B = B;
	this->C = C;
	this->cw = cw;
	this->m_circ = circ;
	this->m_flipped = false;


	a1 = atan2(A.Y()-C.Y(), A.X()-C.X());
	a2 = atan2(B.Y()-C.Y(), B.X()-C.X());
	if(a2<a1)
		a2+=2*M_PI;

	da = a2 - a1;
	rad = C.Distance(A);
	//TODO: compute how far apart the angles are, signed!
	//da = fmod(a2-a1,2*Pi);

#ifdef CHECKFASTARC
	double tax = GetXatU(0);
	double tay = GetYatU(0);
	double tbx = GetXatU(1);
	double tby = GetYatU(1);
	if(tax != A.X() || tay != A.Y() || tbx != B.X() || tby != B.Y())
	{
		int x=0;
		x++;
	}
#endif
}
开发者ID:Blokkendoos,项目名称:heekscad,代码行数:41,代码来源:FastCurves.cpp

示例5: Interpolate

void VectorFont::Glyph::GlyphArc::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
{
	glBegin(GL_LINE_STRIP);
	std::list<gp_Pnt> vertices = Interpolate( starting_point, 20 );
	for (std::list<gp_Pnt>::iterator l_itVertex = vertices.begin(); l_itVertex != vertices.end(); l_itVertex++)
	{
		if (pOrientationModifier) *l_itVertex = pOrientationModifier->Transform(transformation, starting_point.Distance(gp_Pnt(0.0,0.0,0.0)), *l_itVertex, width );
		glVertex3d(l_itVertex->X(), l_itVertex->Y(), l_itVertex->Z());
	} // End for
	glEnd();
} // End glCommands() method
开发者ID:Blokkendoos,项目名称:heekscad,代码行数:18,代码来源:CxfFont.cpp


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