
Wed, 09/17/2025 - 12:24
Forums:
Hello,
I try to find distance between Vertex and Sphere using class BRepExtrema_DistanceSS
. However, it does not work.
Here is my code
#include <BRepExtrema_DistanceSS.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
...
{
auto c = BRepBuilderAPI_MakeVertex({0, 0, 1}).Vertex();
auto s = BRepPrimAPI_MakeSphere(0.5).Shape();
auto bb_1 = Bnd_Box();
auto bb_1_builder = BRepBndLib();
bb_1_builder.Add(c, bb_1);
auto bb_2 = Bnd_Box();
auto bb_2_builder = BRepBndLib();
bb_2_builder.Add(s, bb_2);
auto extrema = BRepExtrema_DistanceSS(c, s, bb_1, bb_2, 100);
auto distance = extrema.DistValue();
printf("dist = %f, done: %d\n", distance, extrema.IsDone());
}
Could you, please, tell why it always returns the "initial distance" (100) and says that nothing is done?
Thanks a lot!