HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_RandomPoint.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_RandomPoint.h ( GU Library, C++)
7  *
8  * COMMENTS: Create a cloud of points on a surface
9  */
10 
11 #ifndef __GU_RandomPoint__
12 #define __GU_RandomPoint__
13 
14 #include "GU_API.h"
15 #include <SYS/SYS_Types.h>
16 #include <UT/UT_VectorTypes.h>
17 #include <UT/UT_String.h>
18 #include <GA/GA_AttributeRef.h>
19 
20 class GU_Detail;
21 class GA_PrimitiveGroup;
22 class GA_PointGroup;
23 
25 {
26 public:
27  //!Random Point Generation
28  //
29  /// This method generates random points from the primitives in the detail.
30  /// gdp - geometry containing the primitives (and which will contain
31  /// the points)
32  /// npoints - The number of points to generate
33  /// seed - random number seed
34  /// probability - A probability array. There should be one entry per
35  /// primitive which determines the probabilty of that primitive
36  /// having a point generated from it.
37  /// group - Optionally, only generate from this group of primitives
38  /// prim_num - Store the primitive number associated with the scattered
39  /// point
40  /// prim_uv - Store the primitive's u/v associated with the point
41  ///
42  /// Points will be generated using as close to a uniform distribution as
43  /// possible (in uv space on the primitives). The point locations should
44  /// remain constant based on primitive number, regardless of shearing or
45  /// scaling.
46  static void generatePoints(GU_Detail &gdp, int npoints, fpreal seed,
47  UT_FloatArray &probability,
48  const GA_PrimitiveGroup *group,
49  const GA_RWAttributeRef &prim_num=GA_RWAttributeRef(),
50  const GA_RWAttributeRef &prim_uv=GA_RWAttributeRef());
51 
52 
53  /// This method generates random points from the points in the detail.
54  /// dstgdp geometry which will contain the generated points
55  /// srcgdp geometry which will contains the source points (can be
56  /// the same as dstgdp)
57  /// srcptgrp the source point group from which to generate points
58  /// ptsperpt- Whether the npts parameter indicates the total number of
59  /// number of points to generate or the number per point.
60  /// npoints - The number of points to generate (total or per-point)
61  /// seed - random number seed
62  /// ptnum - Store the point number of the source point.
63  /// ptidx - Store the index for each point within a particular source
64  /// point. For example if a particular source point generates
65  /// ten points, this attribute's values will range from 0-9.
66  /// emit - An attribute that holds the probability for each source
67  /// point, which determines the probabilty of that point
68  /// having points generated from it.
69  /// attribs - A pattern of point attributes to copy from the source points
70  /// to the generated points.
71  /// details - A pattern of detail attributes to copy from the source
72  ///
73  /// Returns - a contiguous range containing the generated points.
74  ///
75  /// In ptsperpt mode, the source point's "id" attribute will be used for
76  /// stable random probability generation.
77  static GA_Range generatePointsFromPoints(GU_Detail *dstgdp,
78  const GU_Detail *srcgdp,
79  const GA_PointGroup *srcptgrp,
80  fpreal ptsperpt, GA_Size npts,
81  fpreal seed,
82  const GA_RWAttributeRef &dstptnumref,
83  const GA_RWAttributeRef &dstptidxref,
84  const GA_ROAttributeRef &srcemitref,
85  const UT_String &attribpattern,
86  const UT_String &detailpattern);
87 
88 };
89 
90 #endif
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:236
A range of elements in an index-map.
Definition: GA_Range.h:42
This class provides a way to manage a reference to an attribute permitting Read-Write access...
This class provides a way to manage a reference to an attribute permitting Read-Only access...
#define GU_API
Definition: GU_API.h:14
fpreal64 fpreal
Definition: SYS_Types.h:277