[TechDraw] Use templates instead of duplicate code: toGp

This commit is contained in:
Benjamin Bræstrup Sayoc
2024-10-08 00:35:25 +02:00
parent 20ac96f4c8
commit 1d7e7c86a0
13 changed files with 63 additions and 76 deletions

View File

@@ -336,12 +336,12 @@ TopoDS_Shape DrawBrokenView::makeHalfSpace(Base::Vector3d planePoint, Base::Vect
// DU::formatVector(planePoint).c_str(),
// DU::formatVector(planeNormal).c_str(),
// DU::formatVector(pointInSpace).c_str());
gp_Pnt origin = DU::togp_Pnt(planePoint);
gp_Dir axis = DU::togp_Dir(planeNormal);
gp_Pnt origin = DU::to<gp_Pnt>(planePoint);
gp_Dir axis = DU::to<gp_Dir>(planeNormal);
gp_Pln plane(origin, axis);
BRepBuilderAPI_MakeFace mkFace(plane);
TopoDS_Face face = mkFace.Face();
BRepPrimAPI_MakeHalfSpace mkHalf(face, DU::togp_Pnt(pointInSpace));
BRepPrimAPI_MakeHalfSpace mkHalf(face, DU::to<gp_Pnt>(pointInSpace));
return mkHalf.Solid();
}
@@ -966,7 +966,7 @@ Base::Vector3d DrawBrokenView::mapPoint2dFromView(Base::Vector3d point2d) const
gp_Ax3 projCS3(getProjectionCS(getCompressedCentroid()));
gp_Trsf xTo3d;
xTo3d.SetTransformation(projCS3, OXYZ);
auto pseudo3d = DU::toVector3d(DU::togp_Pnt(point2d).Transformed(xTo3d));
auto pseudo3d = DU::toVector3d(DU::to<gp_Pnt>(point2d).Transformed(xTo3d));
// now shift down and left
auto breaksAll = Breaks.getValues();
@@ -1246,7 +1246,7 @@ Base::Vector3d DrawBrokenView::getCompressedCentroid() const
//! construct a perpendicular direction in the projection CS
Base::Vector3d DrawBrokenView::makePerpendicular(Base::Vector3d inDir) const
{
gp_Dir gDir = DU::togp_Dir(inDir);
gp_Dir gDir = DU::to<gp_Dir>(inDir);
gp_Pnt origin(0.0, 0.0, 0.0);
auto dir = getProjectionCS().Direction();
gp_Ax1 axis(origin, dir);