#include <K3dCutPoly.h>
Inheritance diagram for K3dCutPoly:
Public Member Functions | |
K3dCutPoly (K3dGameData *_pGameData) | |
~K3dCutPoly () | |
void | InitCutPoly () |
Init cutting polyhedron class. | |
K3dPolyObj * | Cut (K3dPolyObj *_pPoly, K3dPlaneObj *_pPlane) |
Cut polyhedron by plane and return two new boxes. | |
Private Member Functions | |
bool | CalcNewEdges () |
Calculate new edges from intersection vertex array. | |
void | DeleteOpositePlane (const bool _bIsFrontPoly) |
Delete poly plane if plane lies on oposite side of dividing plane. | |
void | DeleteOpositeEdges (const bool _bIsFrontPoly) |
Delete all back edges from front poly or delete all front edges from back poly. | |
void | AddNewPlane (const bool _bIsFrontPoly) |
Add new plane to the front or back polyhedron. | |
Private Attributes | |
K3dGameData * | m_pGameData |
Global game data, data centered game system. | |
K3dPlaneBuild * | m_pPlaneBuild |
Plane builder. | |
K3dBoxWork * | m_pBoxWork |
Pointer to box worker. | |
K3dIntersection * | m_pIntersection |
Pointer to intersection calculation. | |
K3dBoxBuild * | m_pBoxBuild |
Pointer to box builder. | |
K3dPoly * | m_pPoly |
Polyhedron for cutting. | |
K3dPlaneObj * | m_pPlane |
Cutting plane. | |
K3dPlaneObj * | m_pEdgePlane |
Edge plane. | |
K3dPolyObj * | m_pPolyFront |
New front polyhedrons after polyhedron cutting. | |
K3dPolyObj * | m_pPolyBack |
New back polyhedrons after polyhedron cutting. | |
TVector3Array | m_vVertex |
New vertex array created after edges plane intersection. | |
TLineArray | m_vEdge |
New edge array created after calc new edges. | |
bool | m_bPlaneIntersectPoly |
Switch if plane intersect polyhedron. | |
int | m_iTestVertex |
First testing vertex for CalcNewEdges function. | |
int | m_iNumEdges |
Definition at line 47 of file K3dCutPoly.h.
K3dCutPoly::K3dCutPoly | ( | K3dGameData * | _pGameData | ) |
Definition at line 35 of file K3dCutPoly.cpp.
References K3dSceneData::GetBoxBuild(), K3dSceneData::GetBoxWork(), K3dSceneData::GetIntersection(), K3dSceneData::GetPlaneBuild(), InitCutPoly(), m_bPlaneIntersectPoly, m_iNumEdges, m_iTestVertex, m_pBoxBuild, m_pBoxWork, m_pGameData, m_pIntersection, m_pPlane, m_pPlaneBuild, m_pPoly, m_pPolyBack, and m_pPolyFront.
K3dCutPoly::~K3dCutPoly | ( | ) |
Definition at line 53 of file K3dCutPoly.cpp.
bool K3dCutPoly::CalcNewEdges | ( | ) | [private] |
Calculate new edges from intersection vertex array.
bool | True if created some edge, False if minimum number of vertices or number of edges is equal to number of vertices or if some error |
Definition at line 68 of file K3dCutPoly.cpp.
References K3dPlaneWork::CalcPlane(), K3dVector3Work::CheckVector3Array(), K3dBoxBuild::CreateEdge(), K3dVector3Obj::GetId(), K3dPlane::GetNormal(), K3dSafePointer< _T >::GetNum(), K3dGameData::GetVector3SP(), K3dSceneData::GetVector3Work(), m_iNumEdges, m_iTestVertex, m_pBoxBuild, m_pEdgePlane, m_pGameData, m_pIntersection, m_pPlane, m_pPlaneBuild, m_vVertex, K3dSafePointer< _T >::New(), K3dVector3Work::Normalize(), K3dDistance::PointPlane(), and K3dVector3Work::UnitCross().
Referenced by Cut().
void K3dCutPoly::DeleteOpositePlane | ( | const bool | _bIsFrontPoly | ) | [private] |
Delete poly plane if plane lies on oposite side of dividing plane.
_bIsFrontPoly | Front or back poly swith |
Definition at line 147 of file K3dCutPoly.cpp.
References K3dPoly::DeletePlane(), K3dPoly::GetPlaneArray(), m_pIntersection, m_pPlane, m_pPolyBack, m_pPolyFront, and K3dDistance::PointPlane().
Referenced by Cut().
void K3dCutPoly::DeleteOpositeEdges | ( | const bool | _bIsFrontPoly | ) | [private] |
Delete all back edges from front poly or delete all front edges from back poly.
_bIsFrontPoly | Front or back poly swith |
Definition at line 215 of file K3dCutPoly.cpp.
References K3dPoly::DeleteEdge(), K3dDistance::DistLinePlane(), K3dPoly::GetEdgeArray(), m_pIntersection, m_pPlane, m_pPolyBack, and m_pPolyFront.
void K3dCutPoly::AddNewPlane | ( | const bool | _bIsFrontPoly | ) | [private] |
Add new plane to the front or back polyhedron.
_bIsFrontPoly | Add plane to the front or back polyhedron? |
Definition at line 249 of file K3dCutPoly.cpp.
References K3dPoly::AddPlane(), K3dPolyPlaneBuild::CalcVertsOnPlane(), K3dPolyPlaneBuild::CreateNewPolyPlaneObj(), K3dPlaneVis::GetHeight(), K3dPolyObj::GetIsVisible(), K3dPlaneObj::GetIsVisible(), K3dPlane::GetNormal(), K3dSceneData::GetPolyPlaneBuild(), K3dPlane::GetPosition(), K3dPlaneVis::GetWidth(), K3dVector3::GetX(), K3dVector3::GetY(), K3dVector3::GetZ(), K3dPlaneWork::Init(), K3D_CUTPOLY_SIZE, m_pGameData, m_pPlane, m_pPlaneBuild, m_pPolyBack, m_pPolyFront, and m_vVertex.
Referenced by Cut().
void K3dCutPoly::InitCutPoly | ( | ) |
Init cutting polyhedron class.
Definition at line 58 of file K3dCutPoly.cpp.
References K3dPlaneBuild::CreateNewPlaneObj(), K3dSafePointer< _T >::FindPointer(), K3dGameData::GetPlaneObjSP(), m_pEdgePlane, m_pGameData, and m_pPlaneBuild.
Referenced by K3dCutPoly().
K3dPolyObj * K3dCutPoly::Cut | ( | K3dPolyObj * | _pPoly, | |
K3dPlaneObj * | _pPlane | |||
) |
Cut polyhedron by plane and return two new boxes.
_pPoly | Input polyhedron | |
_pPlane | Cut plane which will be cutting the polyhedron |
K3dPolyObj* | Back polyhedron |
Definition at line 291 of file K3dCutPoly.cpp.
References K3dPoly::AddEdge(), AddNewPlane(), CalcNewEdges(), K3dPolyBuild::CreateNewPolyObj(), K3dCutEdge::CutEdge(), K3dPoly::DeleteEdge(), DeleteOpositePlane(), K3dPoly::GetEdgeArray(), K3dIntrLinePlane::GetLinePlanePos(), K3dSceneData::GetPolyBuild(), K3D_BACK_LINE, K3D_FRONT_LINE, m_iNumEdges, m_iTestVertex, m_pGameData, m_pIntersection, m_pPlane, m_pPolyBack, m_pPolyFront, m_vEdge, and m_vVertex.
K3dGameData* K3dCutPoly::m_pGameData [private] |
Global game data, data centered game system.
Reimplemented from K3dCutEdge.
Definition at line 50 of file K3dCutPoly.h.
Referenced by AddNewPlane(), CalcNewEdges(), Cut(), InitCutPoly(), and K3dCutPoly().
K3dPlaneBuild* K3dCutPoly::m_pPlaneBuild [private] |
Plane builder.
Definition at line 51 of file K3dCutPoly.h.
Referenced by AddNewPlane(), CalcNewEdges(), InitCutPoly(), and K3dCutPoly().
K3dBoxWork* K3dCutPoly::m_pBoxWork [private] |
K3dIntersection* K3dCutPoly::m_pIntersection [private] |
Pointer to intersection calculation.
Reimplemented from K3dCutEdge.
Definition at line 53 of file K3dCutPoly.h.
Referenced by CalcNewEdges(), Cut(), DeleteOpositeEdges(), DeleteOpositePlane(), and K3dCutPoly().
K3dBoxBuild* K3dCutPoly::m_pBoxBuild [private] |
Pointer to box builder.
Definition at line 54 of file K3dCutPoly.h.
Referenced by CalcNewEdges(), and K3dCutPoly().
K3dPoly* K3dCutPoly::m_pPoly [private] |
K3dPlaneObj* K3dCutPoly::m_pPlane [private] |
Cutting plane.
Definition at line 56 of file K3dCutPoly.h.
Referenced by AddNewPlane(), CalcNewEdges(), Cut(), DeleteOpositeEdges(), DeleteOpositePlane(), and K3dCutPoly().
K3dPlaneObj* K3dCutPoly::m_pEdgePlane [private] |
Edge plane.
Definition at line 57 of file K3dCutPoly.h.
Referenced by CalcNewEdges(), and InitCutPoly().
K3dPolyObj* K3dCutPoly::m_pPolyFront [private] |
New front polyhedrons after polyhedron cutting.
Definition at line 58 of file K3dCutPoly.h.
Referenced by AddNewPlane(), Cut(), DeleteOpositeEdges(), DeleteOpositePlane(), and K3dCutPoly().
K3dPolyObj* K3dCutPoly::m_pPolyBack [private] |
New back polyhedrons after polyhedron cutting.
Definition at line 59 of file K3dCutPoly.h.
Referenced by AddNewPlane(), Cut(), DeleteOpositeEdges(), DeleteOpositePlane(), and K3dCutPoly().
TVector3Array K3dCutPoly::m_vVertex [private] |
New vertex array created after edges plane intersection.
Definition at line 60 of file K3dCutPoly.h.
Referenced by AddNewPlane(), CalcNewEdges(), and Cut().
TLineArray K3dCutPoly::m_vEdge [private] |
New edge array created after calc new edges.
Definition at line 61 of file K3dCutPoly.h.
Referenced by Cut().
bool K3dCutPoly::m_bPlaneIntersectPoly [private] |
Switch if plane intersect polyhedron.
Definition at line 62 of file K3dCutPoly.h.
Referenced by K3dCutPoly().
int K3dCutPoly::m_iTestVertex [private] |
First testing vertex for CalcNewEdges function.
Definition at line 63 of file K3dCutPoly.h.
Referenced by CalcNewEdges(), Cut(), and K3dCutPoly().
int K3dCutPoly::m_iNumEdges [private] |