Page 1 of 1

Point to face projection

Posted: Wed Oct 16, 2024 1:03 am
by Renzo Piacenza
I need to project a point to a IBRepFace_DG. I need to make sure the projection is nearest within the wire, not any on the surface. What is the way to do that?

Thanks

Re: Point to face projection

Posted: Mon Oct 21, 2024 6:12 am
by Frank Bentz
I am pretty sure you need to extract the face as another entity, query its IMetrics_DG and use IMetrics_DG.DistPoint.

Details (up to my likely errors):

Code: Select all

IModel_DG model;
IBRepFace theFace;
IBRepShape_DG shape = theFace.As<IBRepShape_DG>();
IEntity_DG entityFace = model.AddBRepShape(shape)
IMetrics_DG metrics = entityFace.As<IMetrics_DG>();
PointDg thePoint, pointProjected;
double d = metrics.DistPoint(thePoint, out pointProjected);
// When done:
model.RemoveEntity(entityFace);