HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Euclid.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  * Defines sops that attach euclidean expressions to gdps.
27  */
28 
29 #ifndef __SOP_Euclid_h__
30 #define __SOP_Euclid_h__
31 
32 #include <SOP/SOP_Node.h>
33 
34 #include "EUC_Expression.h"
35 
36 namespace HDK_Sample {
37 
38 class SOP_EuclidBase : public SOP_Node
39 {
40 protected:
41  SOP_EuclidBase(OP_Network *net, const char *name, OP_Operator *op);
42  virtual ~SOP_EuclidBase();
43 
44  virtual OP_ERROR cookMySop(OP_Context &context);
45 
46  virtual EUC_Expression *cookExpression(OP_Context &context) = 0;
47 
48  EUC_Expression *getInputExpression(int idx) const;
49 
50 protected:
51  bool HIDE(fpreal t) { return (bool)evalInt(0, 0, t); }
52  fpreal CR(fpreal t) { return evalFloat(1, 0, t); }
53  fpreal CG(fpreal t) { return evalFloat(1, 1, t); }
54  fpreal CB(fpreal t) { return evalFloat(1, 2, t); }
55 
57 };
58 
60 {
61 public:
62  static OP_Node *myConstructor(OP_Network*, const char *,
63  OP_Operator *);
65 protected:
66  SOP_EuclidPoint(OP_Network *net, const char *name, OP_Operator *op);
67 
68  virtual EUC_Expression *cookExpression(OP_Context &context);
69 
70  fpreal TX(fpreal t) { return evalFloat(2, 0, t); }
71  fpreal TY(fpreal t) { return evalFloat(2, 1, t); }
72 };
73 
75 {
76 public:
77  static OP_Node *myConstructor(OP_Network*, const char *,
78  OP_Operator *);
80 protected:
81  SOP_EuclidPointFromObject(OP_Network *net, const char *name, OP_Operator *op);
82 
83  virtual EUC_Expression *cookExpression(OP_Context &context);
84 
85  int IDX(fpreal t) { return evalInt(2, 0, t); }
86 };
87 
89 {
90 public:
91  static OP_Node *myConstructor(OP_Network*, const char *,
92  OP_Operator *);
94 protected:
95  SOP_EuclidLineFromPoints(OP_Network *net, const char *name, OP_Operator *op);
96 
97  virtual EUC_Expression *cookExpression(OP_Context &context);
98 };
99 
101 {
102 public:
103  static OP_Node *myConstructor(OP_Network*, const char *,
104  OP_Operator *);
106 protected:
107  SOP_EuclidCircleFromPoints(OP_Network *net, const char *name, OP_Operator *op);
108 
109  virtual EUC_Expression *cookExpression(OP_Context &context);
110 };
111 
113 {
114 public:
115  static OP_Node *myConstructor(OP_Network*, const char *,
116  OP_Operator *);
118 protected:
119  SOP_EuclidIntersect(OP_Network *net, const char *name, OP_Operator *op);
120 
121  virtual EUC_Expression *cookExpression(OP_Context &context);
122 };
123 
125 {
126 public:
127  static OP_Node *myConstructor(OP_Network*, const char *,
128  OP_Operator *);
130 protected:
131  SOP_EuclidSelect(OP_Network *net, const char *name, OP_Operator *op);
132 
133  virtual EUC_Expression *cookExpression(OP_Context &context);
134 
135  int IDX(fpreal t) { return evalInt(2, 0, t); }
136 };
137 
138 }
139 
140 #endif
EUC_Expression * getInputExpression(int idx) const
Definition: SOP_Euclid.C:120
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:332
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:93
fpreal CR(fpreal t)
Definition: SOP_Euclid.h:52
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:260
fpreal TX(fpreal t)
Definition: SOP_Euclid.h:70
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:79
fpreal CG(fpreal t)
Definition: SOP_Euclid.h:53
SOP_EuclidSelect(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:355
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:299
fpreal evalFloat(int pi, int vi, fpreal t) const
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:226
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:64
UT_ErrorSeverity
Definition: UT_Error.h:25
SOP_EuclidCircleFromPoints(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:288
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:366
SOP_EuclidIntersect(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:321
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:326
fpreal CB(fpreal t)
Definition: SOP_Euclid.h:54
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:105
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:232
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:129
SOP_EuclidPointFromObject(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:221
virtual EUC_Expression * cookExpression(OP_Context &context)=0
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:198
GLuint const GLchar * name
Definition: glcorearb.h:785
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:293
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:192
double fpreal
Definition: SYS_Types.h:263
virtual EUC_Expression * cookExpression(OP_Context &context)
Definition: SOP_Euclid.C:266
SOP_EuclidLineFromPoints(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:255
SOP_EuclidPoint(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:187
SOP_EuclidBase(OP_Network *net, const char *name, OP_Operator *op)
Definition: SOP_Euclid.C:103
exint evalInt(int pi, int vi, fpreal t) const
static PRM_Template myTemplateList[]
Definition: SOP_Euclid.h:117
EUC_Expression * myExpression
Definition: SOP_Euclid.h:56
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
Definition: SOP_Euclid.C:360
virtual OP_ERROR cookMySop(OP_Context &context)
Definition: SOP_Euclid.C:134
fpreal TY(fpreal t)
Definition: SOP_Euclid.h:71