Check for overlapping faces

Technical discussions
Post Reply
Janus_vaal
Posts: 4
Joined: Thu Jul 14, 2022 5:20 am

Check for overlapping faces

Post by Janus_vaal »

Hi, I have another one

I am working with Boolean operations on two solids. I need to check whether any faces from the output are already in the initial two solids.

Can anybody provide any way to figure out the common between two faces?

Any help would be appreciated.

Regards,
Janus

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

Re: Check for overlapping faces

Post by Prashant Kande »

Hello Janus

Generally it is not a very common problem. The simplest way is probably to take some points inside one face and check where are they located in another. Below is more general way, which may be close to the simplest.

To figure out location of one face wrt another you need first to check is their surfaces coincide. If they do not, overlapping does not make sense, in my view.

This can be checked with IUVSurface_DG.GetSurfaceLocation(). The faces can overlap only is the method returns SurfaceVsSurfaceLocation_DG.Coinside value.

In the case you have two geometrically coinciding (up to a tolerance) surfaces with (often) different uv parametrization on them. You can think of it as a single surface with two different parametrizations, which has two wires on top of it. Let us talk about the simpler case of a single external wire in each. So you need to figure out location of wires wrt each other.

Such simple face is a 3d image of a curved 2d polygon in uv parameters, sides of which are p-curves

(A) If the faces had identically the same surface (the same parametrization) the problem would be a matter of comparing the two 2D polygons, for which you could use the ICurve2d_DG.GetPointLocation(), intersections and similar functionality.

In general case you will need to map points and 2d curves to the same set of parameters, say, uv plane of the first face. This can be done using projections: If uv1 are parameters of the second face, take its 3d image as IUVSurface_DG.GetPoint(uv1) using IUVSurface_DG of the second face and project it to the surface of the first face.

The projection can be obtained with IUVSurface_DG.GetNearestPoints(). In the case the returned array will have a single point because the surfaces coincide. The point will be the uv image of uv1.

In the same way you can map p-curves, using IUVSurface_DG.GetCurveUVProjection(ICurve_DG curve). So the problem would be reduced to the simple case (A) above
Last edited by Prashant Kande on Sun Jul 24, 2022 2:06 am, edited 1 time in total.

Janus_vaal
Posts: 4
Joined: Thu Jul 14, 2022 5:20 am

Re: Check for overlapping faces

Post by Janus_vaal »

Thank you, Prashant.

Post Reply