Project ray on a solid

Technical discussions
Post Reply
Ben Davidson
Posts: 1
Joined: Thu Mar 10, 2022 3:00 am

Project ray on a solid

Post by Ben Davidson »

Dear all
I hope somebody can save me time looking for this:

Is there a way to project a given point with a given direction on a brep solid?
I mean on the whole surface of the object and avoid working with surfaces. The direction is completely arbitrary, not necessarily parallel, etc. to any face.

Thank you.

Prashant Kande
Posts: 121
Joined: Mon Apr 04, 2016 4:55 am

Re: Project ray on a solid

Post by Prashant Kande »

I do not believe there is a ray to solid projection functionality at the moment.

I think you need to do a bit of coding and do some automation of low-level functionality, namely find all suitable per face projections, take the nearest one and sort out projection of direction.

For a given face access the surface IUVSurface_DG and use either IUVSurface_DG.GetPointUV() or IUVSurface_DG.GetCurveUVProjection(). There will also be some work to sort out location of the point wrt the face's wires. You would need to reject faces with point outside the trimming wires.

In uv parameters a face is a curved polygon. So, location of a point with uv parameters is determined by location of 2d point uv relative to the curved 2d polygon(s) of p-curves of edges. This would also need a bit of coding.

The direction can be handled as a second point very close to the ray's location or using a straight line as a curve and the IUVSurface_DG.GetCurveUVProjection()

Post Reply