View Full Version : 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.
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.
10-19-2003, 04:35 AM
On my website, http://esprit.campus.luth.se/~humus/ , there's a file called Framework.zip, 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.
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.
10-19-2003, 08:17 AM
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?
10-19-2003, 07:57 PM
An example http://hpcc.engin.umich.edu/CFD/users/charlton/Thesis/html/node90.html
Here is that I have:
function Polygon::split from Humus FrameWork
which separates polygon on plan on two parts
void ClipPolygonByFrustum(Polygon *poly_in,Polygon *poly_out, Plane *frstm_planes)
// 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
10-20-2003, 04:49 AM
front is the polygon on the side the normal points to.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.