HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_LocalFrame.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_LocalFrame.h ( GU Library, C++)
7 *
8 * COMMENTS:
9 * Useful functions for computing local coordinate frames for collections
10 * of components.
11 */
12 
13 #ifndef __GU_LocalFrame_h__
14 #define __GU_LocalFrame_h__
15 
16 #include "GU_API.h"
17 
18 #include <GA/GA_Types.h>
19 #include <GA/GA_Edge.h>
20 #include <GA/GA_Breakpoint.h>
21 #include <UT/UT_Function.h>
22 #include <UT/UT_VectorTypes.h>
23 
24 
25 class GA_PointGroup;
26 class GA_PrimitiveGroup;
27 class GA_EdgeGroup;
28 class GA_BreakpointGroup;
29 class GEO_Detail;
30 class GU_Detail;
31 
32 namespace GU_LocalFrame
33 {
34  /// Different types of local frames that can be computed for components.
35  enum FrameType {
39  };
40 
41  /// Different types of local origins that can be computed for components.
42  enum OriginType {
44  };
45 
46  /// A class wrapping some common parameters to the functions computing
47  /// local frames.
49  {
50  public:
52 
53  /// Only used when myFrameType == LOCALFRAME_NMLANDVEC.
55 
56  /// Only used when myFrameType == LOCALFRAME_OBB and computing prim
57  /// local frames. This is only necessary because we need access to
58  /// code in the GT library we cannot access directly from GU. This
59  /// should be set to GT_GUHelpers::computePrimCovariance().
60  using PrimCovarianceFunc =
61  UT_Function<bool(const GU_Detail &gdp,
62  const GA_Range &prim_range,
63  UT_SymMatrix3R &covariance,
64  UT_Vector3R &centroid,
65  UT_Vector3R &avg_normal,
66  UT_Vector3Array *point_positions,
67  GA_OffsetArray *prim_refs)>;
68 
70  };
71 
72  /// A class representing a local frame.
73  class GU_API Frame
74  {
75  public:
78  };
79 
80  /// TODO: Return status flags indicating if something went wrong during
81  /// the computation. For example, failed to compute a good normal.
82 
83  /// Compute the local frames for a list of primitive groupings.
85  const ComputeParms &parms,
86  const GEO_Detail &gdp,
87  const GA_PrimitiveGroup *prim_group,
88  const GA_OffsetArray &class_prims,
89  const UT_ExintArray &class_start_indices,
90  UT_Array<Frame> &class_frames);
91 
92  /// Compute the local frames for a list of point groupings.
94  const ComputeParms &parms,
95  const GEO_Detail &gdp,
96  const GA_PointGroup *point_group,
97  const GA_OffsetArray &class_points,
98  const UT_ExintArray &class_start_indices,
99  UT_Array<Frame> &class_frames);
100 
101  /// Compute the local frames for a list of edge groupings.
103  const ComputeParms &parms,
104  const GEO_Detail &gdp,
105  const GA_EdgeGroup &edge_group,
106  const UT_Array<GA_Edge> &class_edges,
107  const UT_ExintArray &class_start_indices,
108  UT_Array<Frame> &class_frames);
109 
110  /// Compute the local frames for a list of breakpoint groupings.
112  const ComputeParms &parms,
113  const GEO_Detail &gdp,
114  const GA_BreakpointGroup *bkpt_group,
115  const UT_Array<GA_Breakpoint> &class_bkpts,
116  const UT_ExintArray &class_start_indices,
117  UT_Array<Frame> &class_frames);
118 
119  /// Compute the local origins for a list of primitive groupings.
121  OriginType origin_type,
122  const GEO_Detail &gdp,
123  const GA_PrimitiveGroup *prim_group,
124  const GA_OffsetArray &class_prims,
125  const UT_ExintArray &class_start_indices,
126  UT_Array<Frame> &class_frames);
127 
128  /// Compute the local origins for a list of point groupings.
130  OriginType origin_type,
131  const GEO_Detail &gdp,
132  const GA_PointGroup *point_group,
133  const GA_OffsetArray &class_points,
134  const UT_ExintArray &class_start_indices,
135  UT_Array<Frame> &class_frames);
136 
137  /// Compute the local origins for a list of edge groupings.
139  OriginType origin_type,
140  const GEO_Detail &gdp,
141  const GA_EdgeGroup &edge_group,
142  const UT_Array<GA_Edge> &class_edges,
143  const UT_ExintArray &class_start_indices,
144  UT_Array<Frame> &class_frames);
145 
146  /// Compute the local origins for a list of breakpoint groupings.
148  OriginType origin_type,
149  const GEO_Detail &gdp,
150  const GA_BreakpointGroup *bkpt_group,
151  const UT_Array<GA_Breakpoint> &class_bkpts,
152  const UT_ExintArray &class_start_indices,
153  UT_Array<Frame> &class_frames);
154 }
155 
156 #endif // __GU_LocalFrame_h__
GU_API void computePointLocalOrigins(OriginType origin_type, const GEO_Detail &gdp, const GA_PointGroup *point_group, const GA_OffsetArray &class_points, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local origins for a list of point groupings.
UT_Vector3R myUpVector
Only used when myFrameType == LOCALFRAME_NMLANDVEC.
Definition: GU_LocalFrame.h:54
GU_API void computePointLocalFrames(const ComputeParms &parms, const GEO_Detail &gdp, const GA_PointGroup *point_group, const GA_OffsetArray &class_points, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local frames for a list of point groupings.
GU_API void computeBreakpointLocalOrigins(OriginType origin_type, const GEO_Detail &gdp, const GA_BreakpointGroup *bkpt_group, const UT_Array< GA_Breakpoint > &class_bkpts, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local origins for a list of breakpoint groupings.
A class representing a local frame.
Definition: GU_LocalFrame.h:73
Generic symmetric 3x3 matrix.
Definition: UT_SymMatrix3.h:27
GU_API void computeEdgeLocalOrigins(OriginType origin_type, const GEO_Detail &gdp, const GA_EdgeGroup &edge_group, const UT_Array< GA_Edge > &class_edges, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local origins for a list of edge groupings.
GU_API void computeBreakpointLocalFrames(const ComputeParms &parms, const GEO_Detail &gdp, const GA_BreakpointGroup *bkpt_group, const UT_Array< GA_Breakpoint > &class_bkpts, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local frames for a list of breakpoint groupings.
UT_Function< bool(const GU_Detail &gdp, const GA_Range &prim_range, UT_SymMatrix3R &covariance, UT_Vector3R &centroid, UT_Vector3R &avg_normal, UT_Vector3Array *point_positions, GA_OffsetArray *prim_refs)> PrimCovarianceFunc
Definition: GU_LocalFrame.h:67
A range of elements in an index-map.
Definition: GA_Range.h:42
UT_Matrix3R myAxisOrient
Definition: GU_LocalFrame.h:76
GU_API void computePrimLocalOrigins(OriginType origin_type, const GEO_Detail &gdp, const GA_PrimitiveGroup *prim_group, const GA_OffsetArray &class_prims, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local origins for a list of primitive groupings.
OriginType
Different types of local origins that can be computed for components.
Definition: GU_LocalFrame.h:42
#define GU_API
Definition: GU_API.h:14
std::function< T > UT_Function
Definition: UT_Function.h:37
PrimCovarianceFunc myPrimCovarianceFunc
Definition: GU_LocalFrame.h:69
GU_API void computePrimLocalFrames(const ComputeParms &parms, const GEO_Detail &gdp, const GA_PrimitiveGroup *prim_group, const GA_OffsetArray &class_prims, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local frames for a list of primitive groupings.
FrameType
Different types of local frames that can be computed for components.
Definition: GU_LocalFrame.h:35
GU_API void computeEdgeLocalFrames(const ComputeParms &parms, const GEO_Detail &gdp, const GA_EdgeGroup &edge_group, const UT_Array< GA_Edge > &class_edges, const UT_ExintArray &class_start_indices, UT_Array< Frame > &class_frames)
Compute the local frames for a list of edge groupings.
UT_Vector3R myOrigin
Definition: GU_LocalFrame.h:77