Clipping portal polygon by Frustum


I have a problem, i need clip portal polygon by Frustum. Anybody have a function as this does?

I understand this technology, but I need function for practical.

in Style

bool ClipPolygonByFrustum(Vector3D *polygon_in,Vector3D *polygon_out, Planes *frstm_planes);

Vector3D *polygon_out - must be new polygon.

Help me please anybody.

Sorry for my English.

On my website, , there’s a file called, download it and find the Polygon.cpp file. In there I have code which cuts Polygons against a plane. I suppose it could be useful for you.

[This message has been edited by Humus (edited 10-19-2003).]

Thank you Humus

class Polygon, which I have found in your Framework, very good.

I have found in this class Polygon::split() function.

Can you help me, create function ClipPolygonFromFrustum with your function Polygon::split().

I need clip polygon on each side of frustum.
If you worked with portal, then you must know how cut polygon of portal by camera frustum.

for example:

void ClipPolygonFromFrustum(Polygon *poly_in, Polygon *poly_out, Plane *frustum_planes);

But how do it, i don’t know.
Please if you know how do it, help me.

thank you in advance.


Have you tried looking on the web for articles on Sutherland-Hodgeman clipping? This is a common method used to clip polygons against a plane and is fairly easy to code.


This algorithm to me and needs. I searched for on this subject, but nothing necessary has not found. Could you give me some links, On this subject?

An example

thanks roffe

Here is that I have:

function Polygon::split from Humus FrameWork
which separates polygon on plan on two parts

now pseudo-code:

void ClipPolygonByFrustum(Polygon *poly_in,Polygon *poly_out, Plane *frstm_planes)

 Polygon *front;
 Polygon *back;


// Now I have two polygons
// What polygon it is necessary to use
// for next plane.
// front or back?



Sorry for my english

I hope you understand me

front is the polygon on the side the normal points to.