HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GU_PolyKnit.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: GU Library.
7
*
8
* COMMENTS: Class that does the work for the PolyKnit sop.
9
*
10
*/
11
#ifndef __GU_PolyKnit_h__
12
#define __GU_PolyKnit_h__
13
14
#include "
GU_API.h
"
15
#include <
UT/UT_IntArray.h
>
16
#include <
UT/UT_Array.h
>
17
#include <
GEO/GEO_Closure.h
>
18
#include <
GEO/GEO_PointClassifier.h
>
19
20
class
UT_BitArray
;
21
class
GEO_PrimPoly
;
22
class
GU_Detail
;
23
class
gu_WeightPathPair;
24
class
gu_WeightPriorityQueue;
25
26
// The kinds of polygons that can be built with PolyKnit. Meta polygons are
27
// really many polygons that are composed of a path along the connected
28
// geometry.
29
enum
GU_PolyKnitType
30
{
31
GU_POLYKNIT_TRIANGLE
= 0,
32
GU_POLYKNIT_QUAD
,
33
GU_POLYKNIT_META_TRIANGLE
,
34
GU_POLYKNIT_META_QUAD
35
};
36
37
/// Parameters for PolyKnit
38
class
GU_API
GU_PolyKnitParms
39
{
40
public
:
41
bool
myUnique
;
42
bool
myFlipNormals
;
43
bool
myRemoveDegenerates
;
44
bool
myCollapseQuads
;
45
};
46
47
class
GU_API
GU_PolyKnit
48
{
49
public
:
50
GU_PolyKnit
(
GU_Detail
*gdp);
51
52
~GU_PolyKnit
() {}
53
54
/// Builds the polygons in destgdp form the arrays of points and types
55
/// Returns true if completely successful, false otherwise
56
bool
buildPolygons(
GU_Detail
*destgdp,
57
const
UT_IntArray
&ptarray,
58
const
UT_IntArray
&typearray,
59
const
GU_PolyKnitParms
&parms,
60
GA_PrimitiveGroup
*resultprims);
61
62
63
// Finds the shortest path from srcpt to destpt and returns true.
64
// NOTE: This function assumes that the two points are connected
65
bool
getShortestPath(
GA_Offset
srcpt,
GA_Offset
destpt,
66
UT_Array<GA_Offset>
&ptlist);
67
68
/// Returns true if the two points are connected, and false otherwise.
69
/// It uses and adds to our point connector
70
bool
arePointsConnected(
GA_Offset
srcpt,
GA_Offset
destpt);
71
72
private
:
73
// Recalculates the new weights and paths from this new point (srcpt)
74
void
updateWeights(
GA_Offset
srcpt,
float
src_w,
75
UT_Array<GA_Offset>
&src_path,
76
gu_WeightPriorityQueue &pq);
77
78
void
updateWeightsForPoint(
GA_Offset
srcpt,
79
GA_Offset
nextpt,
80
float
src_w,
81
UT_Array<GA_Offset>
&src_path,
82
gu_WeightPriorityQueue &pq,
83
UT_BitArray
&visited);
84
85
// Helper functions for buildPolygons. They all return true if the
86
// succeed and false otherwise
87
bool
buildTriangle(
GU_Detail
*gdp,
const
UT_IntArray
&ptarray,
88
const
UT_Array<GA_Offset>
&newptarray,
89
int
i,
bool
reverse_poly,
bool
remove_degenerates,
90
bool
unique
,
GEO_PrimPoly
*&poly);
91
bool
buildQuad(
GU_Detail
*gdp,
const
UT_IntArray
&ptarray,
92
const
UT_Array<GA_Offset>
&newptarray,
93
int
i,
bool
reverse_poly,
bool
remove_degenerates,
94
bool
unique
,
bool
collapse_quads,
95
GEO_PrimPoly
*&poly);
96
bool
buildMetaTriangle(
GU_Detail
*gdp,
97
const
UT_IntArray
&ptarray,
98
UT_Array<GA_Offset>
&newptarray,
99
int
idx,
bool
reverse_poly,
bool
remove_degenerates,
100
bool
unique
,
GA_PrimitiveGroup
*resultprims);
101
bool
buildMetaQuad(
GU_Detail
*gdp,
const
UT_IntArray
&ptarray,
102
UT_Array<GA_Offset>
&newptarray,
103
int
idx,
bool
reverse_poly,
bool
remove_degenerates,
104
bool
unique
,
bool
collapse_quads,
105
GA_PrimitiveGroup
*resultprims);
106
107
// Takes the points in srcptlist and copies them to the gdp, making note
108
// of it in newptarray
109
void
createNewPoints(
GU_Detail
*gdp,
110
const
UT_Array<GA_Offset>
&srcptlist,
111
UT_Array<GA_Offset>
&newptarray);
112
113
// Re-orders the given points so that the two source points are connected
114
// and the two destination points are connected. If we can't do that
115
// we return false, otherwise we return true. Order is also important,
116
// so we try to keep the order (srcpt0 doesn't change)
117
bool
reorderPoints(
GA_Offset
srcpt0,
GA_Offset
&srcpt1,
118
GA_Offset
&destpt0,
GA_Offset
&destpt1);
119
// This version tries to make sure that destpt0 and destpt1 are connected
120
bool
reorderPoints(
GA_Offset
&srcpt,
GA_Offset
&destpt0,
121
GA_Offset
&destpt1);
122
123
// Just build a triangle/quad with the given point numbers, the unique flag
124
// says where to grab the points from (the new point list or the gdp),
125
// and the reverse flag says whether or not the point orders should be
126
// reversed
127
GEO_PrimPoly
*createTriangle(
int
i0,
int
i1
,
int
i2
,
128
bool
unique
,
bool
reverse
,
GU_Detail
*gdp,
129
UT_Array<GA_Offset>
&newptarray);
130
GEO_PrimPoly
*createQuad(
int
i0,
int
i1
,
int
i2
,
int
i3,
bool
unique
,
131
bool
reverse
,
GU_Detail
*gdp,
132
UT_Array<GA_Offset>
&newptarray);
133
134
135
GU_Detail
*myGdp;
136
GEO_Closure
myClosure;
137
GEO_PointClassifier
myPointClassifier;
138
};
139
140
#endif
UT_BitArray
Definition:
UT_BitArray.h:29
GA_PrimitiveGroup
Definition:
GA_ElementGroup.h:74
UT_IntArray.h
GU_POLYKNIT_META_QUAD
Definition:
GU_PolyKnit.h:34
GEO_PointClassifier
Definition:
GEO_PointClassifier.h:22
i2
GLint GLint i2
Definition:
glad.h:2724
reverse
void reverse(I begin, I end)
Definition:
pugixml.cpp:7190
GU_PolyKnit::~GU_PolyKnit
~GU_PolyKnit()
Definition:
GU_PolyKnit.h:52
GEO_PointClassifier.h
GU_PolyKnitParms::myUnique
bool myUnique
Definition:
GU_PolyKnit.h:41
UT_Array.h
GEO_Closure.h
UT_ValArray< int >
UT_Array< GA_Offset >
GEO_PrimPoly
Definition:
GEO_PrimPoly.h:25
GA_Offset
GA_Size GA_Offset
Definition:
GA_Types.h:646
GU_PolyKnitParms
Parameters for PolyKnit.
Definition:
GU_PolyKnit.h:38
GU_PolyKnit
Definition:
GU_PolyKnit.h:47
GU_PolyKnitParms::myFlipNormals
bool myFlipNormals
Definition:
GU_PolyKnit.h:42
GU_POLYKNIT_META_TRIANGLE
Definition:
GU_PolyKnit.h:33
GU_PolyKnitType
GU_PolyKnitType
Definition:
GU_PolyKnit.h:29
GU_PolyKnitParms::myRemoveDegenerates
bool myRemoveDegenerates
Definition:
GU_PolyKnit.h:43
i1
GLint i1
Definition:
glad.h:2724
GU_API
#define GU_API
Definition:
GU_API.h:14
GU_PolyKnitParms::myCollapseQuads
bool myCollapseQuads
Definition:
GU_PolyKnit.h:44
GU_POLYKNIT_TRIANGLE
Definition:
GU_PolyKnit.h:31
unique
I unique(I begin, I end)
Definition:
pugixml.cpp:7195
GU_Detail
Definition:
GU_Detail.h:154
GEO_Closure
Definition:
GEO_Closure.h:40
GU_API.h
GU_POLYKNIT_QUAD
Definition:
GU_PolyKnit.h:32
GU
GU_PolyKnit.h
Generated on Sun Nov 17 2024 03:01:19 for HDK by
1.8.6