HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEO_Normal.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: GEO_Normal.h (GEO Library, C++)
7  *
8  * COMMENTS: Functions for computing normals
9  */
10 
11 #pragma once
12 
13 #ifndef __GEO_Normal__
14 #define __GEO_Normal__
15 
16 #include "GEO_API.h"
17 #include <GA/GA_Handle.h>
18 #include <stddef.h>
19 
20 class GEO_Detail;
21 class GA_Group;
22 
23 #define GEO_DEFAULT_CUSP_ANGLE 60.0
24 
25 /// Magic tolerance factor of 1.001 on GEO_DEFAULT_CUSP_ANGLE so that
26 /// hexagonal tubes will be smooth by default, even with a bit of roundoff
27 /// or slight deformation.
28 #define GEO_DEFAULT_ADJUSTED_CUSP_ANGLE 60.06
29 
30 /// This determines how contributions from multiple vertices around a point
31 /// get weighted when computing a normal for that point.
32 enum class GEO_NormalMethod
33 {
34  UNIFORM_WEIGHTED, // Each vertex gets equal weight
35  ANGLE_WEIGHTED, // Each vertex is weighted by angle (usually best results)
36  AREA_WEIGHTED // Each vertex is weighted by total face area
37 };
38 
39 /// Computes normals into given attribute using detail->getP().
40 /// If group is specified, only the associated elements are updated.
41 /// If normalattrib is a detail attribute and group is given,
42 /// it is only computed based on the primitives associated with the group.
43 /// If vertex normals, a cusp angle of 0 or less cusps everything, and
44 /// a cusp angle of 180 or more cusps nothing.
46  const GEO_Detail &detail,
47  const GA_RWHandleV3 &normalattrib,
48  const GA_Group *group = NULL,
49  const float cuspangledegrees = GEO_DEFAULT_ADJUSTED_CUSP_ANGLE,
51 
52 /// Computes normals into given attribute using pos_attrib (owned by detail).
53 /// If group is specified, only the associated elements are updated.
54 /// If normalattrib is a detail attribute and group is given,
55 /// it is only computed based on the primitives associated with the group.
56 /// If vertex normals, a cusp angle of 0 or less cusps everything, and
57 /// a cusp angle of 180 or more cusps nothing.
59  const GEO_Detail &detail,
60  const GA_ROHandleV3 &posattrib,
61  const GA_RWHandleV3 &normalattrib,
62  const GA_Group *group = NULL,
63  const float cuspangledegrees = GEO_DEFAULT_ADJUSTED_CUSP_ANGLE,
65 
66 #endif
GEO_NormalMethod
Definition: GEO_Normal.h:32
void GEO_API GEOcomputeNormals(const GEO_Detail &detail, const GA_RWHandleV3 &normalattrib, const GA_Group *group=NULL, const float cuspangledegrees=GEO_DEFAULT_ADJUSTED_CUSP_ANGLE, const GEO_NormalMethod method=GEO_NormalMethod::ANGLE_WEIGHTED)
#define GEO_DEFAULT_ADJUSTED_CUSP_ANGLE
Definition: GEO_Normal.h:28
int method
Definition: png.h:1924
#define GEO_API
Definition: GEO_API.h:10