29 PYTHON
class Shape :
public PbClass {
31 enum GridType { TypeNone = 0, TypeBox = 1, TypeSphere = 2, TypeCylinder = 3, TypeSlope = 4 };
36 inline GridType
getType()
const {
return mType; }
40 PYTHON()
void applyToGridSmooth(
GridBase* grid, Real sigma=1.0, Real shift=0,
FlagGrid* respectFlags=0);
42 PYTHON()
void collideMesh(
Mesh& mesh);
44 PYTHON()
virtual void setCenter(
const Vec3& center) {}
49 inline bool isInsideGrid(
int i,
int j,
int k)
const {
return isInside(
Vec3(i+0.5,j+0.5,k+0.5)); };
51 virtual void generateMesh(
Mesh* mesh) {} ;
52 virtual void generateLevelset(
Grid<Real>& phi) {};
65 virtual void generateMesh(
Mesh* mesh) {}
68 virtual void generateLevelset(
Grid<Real>& phi) { gridSetConst<Real>( phi , 1000.0f ); }
77 inline Vec3 getSize()
const {
return mP1-mP0; }
78 inline Vec3 getP0()
const {
return mP0; }
79 inline Vec3 getP1()
const {
return mP1; }
80 virtual void setCenter(
const Vec3& center) {
Vec3 dh=0.5*(mP1-mP0); mP0 = center-dh; mP1 = center+dh;}
81 virtual Vec3 getCenter()
const {
return 0.5*(mP1+mP0); }
82 virtual Vec3 getExtent()
const {
return getSize(); }
84 virtual void generateMesh(
Mesh* mesh);
85 virtual void generateLevelset(
Grid<Real>& phi);
97 virtual void setCenter(
const Vec3& center) { mCenter = center; }
98 virtual Vec3 getCenter()
const {
return mCenter; }
99 inline Real getRadius()
const {
return mRadius; }
100 virtual Vec3 getExtent()
const {
return Vec3(2.0*mRadius); }
102 virtual void generateMesh(
Mesh* mesh);
103 virtual void generateLevelset(
Grid<Real>& phi);
106 Vec3 mCenter, mScale;
116 PYTHON()
void setRadius(Real r) { mRadius = r; }
117 PYTHON()
void setZ(
Vec3 z) { mZDir=z; mZ=normalize(mZDir); }
119 virtual void setCenter(
const Vec3& center) { mCenter=center; }
120 virtual Vec3 getCenter()
const {
return mCenter; }
121 inline Real getRadius()
const {
return mRadius; }
122 inline Vec3 getZ()
const {
return mZ*mZDir; }
123 virtual Vec3 getExtent()
const {
return Vec3(2.0*sqrt(square(mZ)+square(mRadius))); }
125 virtual void generateMesh(
Mesh* mesh);
126 virtual void generateLevelset(
Grid<Real>& phi);
143 virtual void setOrigin (
const Real& origin) { mOrigin=origin; }
144 virtual void setAnglexy(
const Real& anglexy) { mAnglexy=anglexy; }
145 virtual void setAngleyz(
const Real& angleyz) { mAnglexy=angleyz; }
147 inline Real getOrigin()
const {
return mOrigin; }
148 inline Real getmAnglexy()
const {
return mAnglexy; }
149 inline Real getmAngleyz()
const {
return mAngleyz; }
151 virtual void generateMesh(
Mesh* mesh);
152 virtual void generateLevelset(
Grid<Real>& phi);
155 Real mAnglexy, mAngleyz;
Definition: commonkernels.h:22
Basic inlined vector class.
Definition: vectorbase.h:71
static const Vector3D< S > Zero
zero element
Definition: vectorbase.h:212
Triangle mesh class.
Definition: mesh.h:126
Definition: levelset.h:25
GridType getType() const
Get the type of grid.
Definition: shapes.h:36
virtual bool isInside(const Vec3 &pos) const
Inside test of the shape.
Definition: shapes.cpp:37
virtual bool isInside(const Vec3 &pos) const
Inside test of the shape.
Definition: shapes.h:64
Slope shape.
Definition: shapes.h:139
Definition: fluidsolver.h:28