本文整理汇总了C++中gp_Pnt::Z方法的典型用法代码示例。如果您正苦于以下问题:C++ gp_Pnt::Z方法的具体用法?C++ gp_Pnt::Z怎么用?C++ gp_Pnt::Z使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gp_Pnt
的用法示例。
在下文中一共展示了gp_Pnt::Z方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例2: 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;
}
}
示例3:
bool rs274emc::comparePoints(gp_Pnt a,gp_Pnt b)
{
bool result=0, xIdent=0, yIdent=0, zIdent=0;
xIdent=!(a.X()-b.X());
yIdent=!(a.Y()-b.Y());
zIdent=!(a.Z()-b.Z());
if (xIdent && yIdent && zIdent)
result=1;
return result;
}
示例4: gp_PntCompare
//is p1 "less than" p2?
bool ImpExpDxfWrite::gp_PntCompare(gp_Pnt p1, gp_Pnt p2)
{
bool result = false;
if (!(p1.IsEqual(p2,Precision::Confusion()))) { //ie v1 != v2
if (!(fabs(p1.X() - p2.X()) < Precision::Confusion())) { // x1 != x2
result = p1.X() < p2.X();
} else if (!(fabs(p1.Y() - p2.Y()) < Precision::Confusion())) { // y1 != y2
result = p1.Y() < p2.Y();
} else {
result = p1.Z() < p2.Z();
}
}
return result;
}
示例5: 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()));
}
示例6: SetTopCurrentPos
void CGuideRectODL::SetTopCurrentPos( gp_Pnt ptCurrent )
{
CBaseODL::SetTopCurrentPos(ptCurrent);
m_rtArea.Width = static_cast<Gdiplus::REAL>(abs(m_ptTopStart.X() - ptCurrent.X()));
m_rtArea.Height = static_cast<Gdiplus::REAL>(abs(m_ptTopStart.Z() - ptCurrent.Z()));
if (m_ptTopStart.X()>ptCurrent.X())
{
m_rtArea.X = static_cast<Gdiplus::REAL>(ptCurrent.X());
}
if ( ptCurrent.Z()<m_ptTopStart.Z())
{
m_rtArea.Y= static_cast<Gdiplus::REAL>(ptCurrent.Z());
}
}
示例7: 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());
}
示例8: 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);
}
示例9:
point3D gPntTopoint3D(gp_Pnt& p)
{
point3D result;
result.x = p.X();
result.y = p.Y();
result.z = p.Z();
return result;
}
示例10: 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");
}
}
示例11: OnTopMoving
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);
}
}
示例12: 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;
}
}
示例13: message
/* static */ gp_Pnt HPoint::GetOffset(gp_Pnt location)
{
wxString message(_("Enter offset in X,Y,Z format (with commas between them)"));
wxString caption(_("Apply Offset To Selected Location"));
wxString default_value(_T("0,0,0"));
wxString value = wxGetTextFromUser(message, caption, default_value);
wxStringTokenizer tokens(value,_T(":,\t\n"));
for (int i=0; i<3; i++)
{
if (tokens.HasMoreTokens())
{
double offset = 0.0;
wxString token = tokens.GetNextToken();
wxString evaluated_version;
if (PropertyDouble::EvaluateWithPython( NULL, token, evaluated_version ))
{
evaluated_version.ToDouble(&offset);
offset *= wxGetApp().m_view_units;
switch(i)
{
case 0:
location.SetX( location.X() + offset );
break;
case 1:
location.SetY( location.Y() + offset );
break;
case 2:
location.SetZ( location.Z() + offset );
break;
}
}
}
}
return(location);
}
示例14: gp_Vec
//! \relates MathTools
gp_Vec operator-(const gp_Pnt& p1, const gp_Pnt& p2)
{
return gp_Vec(p2.X() - p1.X(), p2.Y() - p1.Y(), p2.Z() - p1.Z());
}
示例15: projectFace
//! project a single face using HLR - used for section faces
TopoDS_Face DrawViewSection::projectFace(const TopoDS_Shape &face,
gp_Pnt faceCenter,
const Base::Vector3d &direction)
{
if(face.IsNull()) {
throw Base::Exception("DrawViewSection::projectFace - input Face is NULL");
}
Base::Vector3d origin(faceCenter.X(),faceCenter.Y(),faceCenter.Z());
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(origin,direction);
HLRBRep_Algo *brep_hlr = new HLRBRep_Algo();
brep_hlr->Add(face);
HLRAlgo_Projector projector( viewAxis );
brep_hlr->Projector(projector);
brep_hlr->Update();
brep_hlr->Hide();
HLRBRep_HLRToShape hlrToShape(brep_hlr);
TopoDS_Shape hardEdges = hlrToShape.VCompound();
// TopoDS_Shape outEdges = hlrToShape.OutLineVCompound();
std::vector<TopoDS_Edge> faceEdges;
TopExp_Explorer expl(hardEdges, TopAbs_EDGE);
int i;
for (i = 1 ; expl.More(); expl.Next(),i++) {
const TopoDS_Edge& edge = TopoDS::Edge(expl.Current());
if (edge.IsNull()) {
Base::Console().Log("INFO - DVS::projectFace - hard edge: %d is NULL\n",i);
continue;
}
faceEdges.push_back(edge);
}
//TODO: verify that outline edges aren't required
//if edge is both hard & outline, it will be duplicated? are hard edges enough?
// TopExp_Explorer expl2(outEdges, TopAbs_EDGE);
// for (i = 1 ; expl2.More(); expl2.Next(),i++) {
// const TopoDS_Edge& edge = TopoDS::Edge(expl2.Current());
// if (edge.IsNull()) {
// Base::Console().Log("INFO - GO::projectFace - outline edge: %d is NULL\n",i);
// continue;
// }
// bool addEdge = true;
// //is edge already in faceEdges? maybe need to use explorer for this for IsSame to work?
// for (auto& e:faceEdges) {
// if (e.IsPartner(edge)) {
// addEdge = false;
// Base::Console().Message("TRACE - DVS::projectFace - skipping an edge 1\n");
// }
// }
// expl.ReInit();
// for (; expl.More(); expl.Next()){
// const TopoDS_Edge& eHard = TopoDS::Edge(expl.Current());
// if (eHard.IsPartner(edge)) {
// addEdge = false;
// Base::Console().Message("TRACE - DVS::projectFace - skipping an edge 2\n");
// }
// }
// if (addEdge) {
// faceEdges.push_back(edge);
// }
// }
TopoDS_Face projectedFace;
if (faceEdges.empty()) {
Base::Console().Log("LOG - DVS::projectFace - no faceEdges\n");
return projectedFace;
}
//recreate the wires for this single face
EdgeWalker ew;
ew.loadEdges(faceEdges);
bool success = ew.perform();
if (success) {
std::vector<TopoDS_Wire> fw = ew.getResultNoDups();
if (!fw.empty()) {
std::vector<TopoDS_Wire> sortedWires = ew.sortStrip(fw, true);
if (sortedWires.empty()) {
return projectedFace;
}
BRepBuilderAPI_MakeFace mkFace(sortedWires.front(),true); //true => only want planes?
std::vector<TopoDS_Wire>::iterator itWire = ++sortedWires.begin(); //starting with second face
for (; itWire != sortedWires.end(); itWire++) {
mkFace.Add(*itWire);
}
projectedFace = mkFace.Face();
}
} else {
Base::Console().Warning("DVS::projectFace - input is not planar graph. No face detection\n");
}
return projectedFace;
}