Determining if a surface is in the YZ plane


I have built myself a TopoDS_Shape called nosecap. Its basically a hemi-sphere with a chunk cut off with a constant X plane. I am using explorer to investigate the faces of the nosecap and determine which one is in this constant X plane. I then want to glue this face to the same face on another shape I have built. Here is the code with a ? indicating where I am stuck:

TopoDS_Face foundface;
TopoExp_Explorer ex;
for(ex.Init(nosecap,TopAbs_Face);ex.more; ex.Next) {
TopoDS_Face facenow = TopoDS::Face(ex.Current());
Handle(Geom_Surface) surface = BRep_Tool::Surface(facenow);
if ( ? )
foundface = facenow;

I want to check if the "surface" is in a plane of constant X. I can't figure out how to do this. Any suggestions?


Stephane Routelous's picture

Hi Cathy,

you can try :

if ( surface->IsKind(STANDARD_TYPE(Geom_Plane)))
Handle_Geom_Plane plane = Handle_Geom_Plane::DownCast(surface);
Standard_Real A,B,C,D;
if ( A != 0 && B == 0 && C == 0 )
//the plane is parallel to YZ plane at x=-D/A



croberts's picture

Thanks Stephane!

I was looking for something like IsKind but for some reason missed it in my exploration through the documentation.

I didn't even think of getting the plane coefficients and testing them.

Great ideas! Thanks so much.