OctreeNode Class Reference

#include <Brep.h>

Collaboration diagram for OctreeNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OctreeNode (BREP_VERTEX *new_vertex, BREP_SOLID *sld)
 OctreeNodeのコンストラクタは,BREP_VERTEXに対して,新たに領域を作らずにポインタをコピーすることに注意!!
 ~OctreeNode ()
OctreeNodeAddWithUnique (BREP_VERTEX *new_vertex)
OctreeNodeAddWithDuplicates (BREP_VERTEX *new_vertex)
OctreeNodeFindSubtree (BREP_VERTEX *element)
 Vertex element と同じ位置にある Vertexを含むノードを返す..
void ComputeVerticesNormal (void)

Public Attributes

BREP_SOLIDsolid

Private Attributes

BREP_VERTEXvertex
 ルートノードの場合は NULL
OctreeNodechild [8]

Friends

BREP_VERTEX ** GetOctreeVertices (OctreeNode *octree, long int *vertexno)
long int OctreeGetter (OctreeNode *p, BREP_VERTEX **vtx, long int counter)
BREP_VERTEXAddVertex2Octree (BREP_VERTEX *vertex, OctreeNode *octree, bool dupli)

Detailed Description

Definition at line 292 of file Brep.h.


Constructor & Destructor Documentation

OctreeNode ( BREP_VERTEX new_vertex,
BREP_SOLID sld 
)

Definition at line 695 of file Brep.cpp.

References OctreeNode::child, BREP_VERTEX::index, OctreeNode::solid, OctreeNode::vertex, and BREP_SOLID::vertexid.

Referenced by OctreeNode::AddWithDuplicates(), and OctreeNode::AddWithUnique().

00696 {
00697     solid  = sld;
00698     vertex = new_vertex;
00699 
00700     if (solid!=NULL && vertex!=NULL) {
00701         vertex->index = solid->vertexid;
00702         solid->vertexid++;
00703     }
00704 
00705     for (int i=0; i<8; i++) child[i] = NULL;
00706 }

Here is the caller graph for this function:

~OctreeNode (  ) 

Definition at line 710 of file Brep.cpp.

References OctreeNode::child, OctreeNode::solid, OctreeNode::vertex, and BREP_SOLID::vertexno.

00711 {
00712     for (int i=0; i<8; i++) {
00713         if (child[i]!=NULL) delete child[i];
00714     }
00715 
00716     if (vertex!=NULL) {
00717         delete vertex;
00718         if (solid!=NULL) solid->vertexno--;
00719     }
00720 }


Member Function Documentation

OctreeNode * AddWithDuplicates ( BREP_VERTEX new_vertex  ) 

Octreeに Vertex new_vertex そのものを登録する.重複登録を許す. 登録した OctreeNode を返す.

OctreeNode* OctreeNode::AddWithDuplicates(BREP_VERTEX* new_vertex)

Octreeに Vertex new_vertex そのものを登録する.重複登録を許す.
登録した OctreeNodeを返す.

Definition at line 769 of file Brep.cpp.

References OctreeNode::child, jbxl::CompareVertex(), BREP_VERTEX::index, OctreeNode::OctreeNode(), OctreeNode::solid, OctreeNode::vertex, and BREP_SOLID::vertexid.

Referenced by jbxl::AddVertex2Octree().

00770 {
00771     OctreeNode* o = NULL;
00772     OctreeNode* p = this;
00773     int cmp = -1;
00774 
00775     if (new_vertex==NULL) return this;
00776 
00777     if (p->vertex==NULL) {  // 一番最初の Vertex
00778         p->vertex = new_vertex;
00779         if (solid!=NULL) {
00780             p->vertex->index = solid->vertexid;
00781             solid->vertexid++;
00782         }
00783         return p;
00784     }
00785 
00786     while (p!=NULL) {
00787         cmp = CompareVertex(p->vertex, new_vertex);
00788         o = p;
00789         p = p->child[cmp%8];
00790     }
00791 
00792     if (cmp>=0 && o!=NULL) {
00793         p = new OctreeNode(new_vertex, solid);
00794         o->child[cmp%8] = p;
00795     }
00796     return p;
00797 }

Here is the call graph for this function:

Here is the caller graph for this function:

OctreeNode * AddWithUnique ( BREP_VERTEX new_vertex  ) 

Octreeに Vertex new_vertexそのものを登録する.登録した OctreeNodeを返す. 既に同じ位置のVertexが登録済み(UVマップも比べる)の場合は,その OctreeNodeを返す.

OctreeNode* OctreeNode::AddWithUnique(BREP_VERTEX* new_vertex)

Octreeに Vertex new_vertexそのものを登録する.登録した OctreeNodeを返す. 既に同じ位置のVertexが登録済みの場合は,その OctreeNodeを返す.

Definition at line 730 of file Brep.cpp.

References OctreeNode::child, jbxl::CompareVertex(), BREP_VERTEX::index, OctreeNode::OctreeNode(), OctreeNode::solid, OctreeNode::vertex, and BREP_SOLID::vertexid.

Referenced by jbxl::AddVertex2Octree().

00731 {
00732     OctreeNode* o = NULL;
00733     OctreeNode* p = this;
00734     int cmp = -1;
00735 
00736     if (new_vertex==NULL) return NULL;
00737 
00738     if (p->vertex==NULL) {      // 一番最初の Vertex
00739         p->vertex = new_vertex;
00740         if (solid!=NULL) {
00741             p->vertex->index = solid->vertexid;
00742             solid->vertexid++;
00743         }
00744         return p;
00745     }
00746 
00747     while (p!=NULL) {
00748         cmp = CompareVertex(p->vertex, new_vertex);
00749         if (cmp==8) return p;   // 既に同じ位置のVertexが登録済み
00750         o = p;
00751         p = p->child[cmp];
00752     }
00753 
00754     if (cmp>=0 && o!=NULL) {
00755         p = new OctreeNode(new_vertex, solid);
00756         o->child[cmp] = p;
00757     }
00758     return p;
00759 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ComputeVerticesNormal ( void   ) 

Definition at line 821 of file Brep.cpp.

References BREP_VERTEX::calc_normal, OctreeNode::child, BREP_VERTEX::ComputeNormal(), OctreeNode::ComputeVerticesNormal(), and OctreeNode::vertex.

Referenced by BREP_SOLID::CloseData(), and OctreeNode::ComputeVerticesNormal().

00822 {
00823     for (int i=0; i<8; i++) {
00824         if (child[i]!=NULL) {
00825             child[i]->ComputeVerticesNormal();
00826         }
00827     }
00828     if (vertex!=NULL && vertex->calc_normal) vertex->ComputeNormal();
00829 }

Here is the call graph for this function:

Here is the caller graph for this function:

OctreeNode * FindSubtree ( BREP_VERTEX element  ) 

OctreeNode* OctreeNode::FindSubtree(BREP_VERTEX* element)

Vertex element と同じ位置にある Vertexを含むノードを返す.

Definition at line 806 of file Brep.cpp.

References OctreeNode::child, jbxl::CompareVertex(), and OctreeNode::vertex.

00807 {
00808     OctreeNode* p = this;
00809     while(p!=NULL){
00810         int cmp = CompareVertex(p->vertex, element);
00811         if (cmp==8) return p;
00812         if (cmp<0)  return NULL; 
00813         p = p->child[cmp];
00814     }
00815     return NULL;
00816 }

Here is the call graph for this function:


Friends And Related Function Documentation

BREP_VERTEX* AddVertex2Octree ( BREP_VERTEX vertex,
OctreeNode octree,
bool  dupli 
) [friend]
BREP_VERTEX** GetOctreeVertices ( OctreeNode octree,
long int *  vertexno 
) [friend]
long int OctreeGetter ( OctreeNode p,
BREP_VERTEX **  vtx,
long int  counter 
) [friend]

Member Data Documentation

OctreeNode* child[8] [private]
BREP_VERTEX* vertex [private]

The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Lib++ (for Windows) by  doxygen 1.6.1