Point to face projection

Everything DG Kernel: Technical discussions and issues
Post Reply
Renzo Piacenza
Posts: 1
Joined: Wed Oct 16, 2024 12:57 am

Point to face projection

Post 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
Frank Bentz
Posts: 1
Joined: Mon Oct 21, 2024 5:58 am

Re: Point to face projection

Post 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);
Post Reply