3 #include <gp_Cylinder.hxx>
5 #include <BRepPrimAPI_MakeCylinder.hxx>
15 double r = cylinder.Radius();
17 gp_Ax1
ax1 = cylinder.Axis();
18 gp_Dir dir = ax1.Direction();
19 gp_Ax2 ax2 = cylinder.Position().Ax2();
20 gp_Pnt x0 = cylinder.Location();
21 double dist_to_sphere = cylinder.Location().Distance(*bcenter);
22 double safe_dimension = dist_to_sphere + bradius;
23 double t = safe_dimension;
24 gp_Pnt x1(x0.X() - t*dir.X(), x0.Y()- t*dir.Y(), x0.Z()- t*dir.Z());
26 ax2.SetDirection(dir);
27 mSolid =
new TopoDS_Shape(BRepPrimAPI_MakeCylinder(ax2, r, 2 * safe_dimension).Solid());
29 mCylinder =
new gp_Cylinder(gp_Ax3(ax2), r);
39 if (!other)
return false;
51 gp_XYZ diff(cyl->Location().X() - cyr->Location().X(),
52 cyl->Location().Y() - cyr->Location().Y(),
53 cyl->Location().Z() - cyr->Location().Z());
57 gp_XYZ axis(cyl->Axis().Direction().X(),
58 cyl->Axis().Direction().Y(),
59 cyl->Axis().Direction().Z());
60 double pro = diff.Dot(axis);
61 gp_XYZ vpro = pro*axis, vnorm = diff - vpro;