2
* Copyright (C) 2001-2005 Terence M. Welsh
4
* This file is part of Implicit.
6
* Implicit is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License version 2.1 as published by the Free Software Foundation.
10
* Implicit is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
// This is a generic class from which specific elements are
26
// derived. An element would be a sphere or torus or anything
27
// that defines an implicit surface.
30
#include <Implicit/impCrawlPoint.h>
38
// Thickness is only necessary in torii and knots, but can be used in other shapes.
39
// Thickness is different from scale (which can be applied using an element's
40
// matrix) because it only scales the width of appendages and not their relative
42
// thicknessSquared is often useful in the value() function, so it is precomputed.
43
float thickness, thicknessSquared;
46
virtual ~impShape(){};
47
void setPosition(float x, float y, float z);
48
void setPosition(float* position);
49
void setMatrix(float* m);
51
void setThickness(float t){
53
thicknessSquared = thickness * thickness;
55
float getThickness(){return thickness;}
56
// returns the value of this element at a given position
57
// "position" is an array of 3 floats
58
virtual float value(float* position);
59
// assigns a center of the element's volume to "position"
60
virtual void center(float* position);
61
// adds surface crawler start position(s) to given crawlPointVector
62
virtual void addCrawlPoint(impCrawlPointVector &cpv);