summaryrefslogtreecommitdiff
path: root/src/primitives.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-07-11 01:54:20 (GMT)
committerMarius Kintel <marius@kintel.net>2011-07-11 01:54:20 (GMT)
commit21ac6c05d16e9b2eca360dbbe684335ee2431af6 (patch)
tree7c5c3215565f872d83af4190437c38a6edd3d760 /src/primitives.cc
parent65a5df881092d89e90e71e180c689a711770c801 (diff)
parent381a31199755a205189534fe727a9e8167f0715c (diff)
merged in recent changes in master
Diffstat (limited to 'src/primitives.cc')
-rw-r--r--src/primitives.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/primitives.cc b/src/primitives.cc
index def90c9..7e399dc 100644
--- a/src/primitives.cc
+++ b/src/primitives.cc
@@ -37,6 +37,8 @@
#include <sstream>
#include <assert.h>
+#define F_MINIMUM 0.01
+
enum primitive_type_e {
CUBE,
SPHERE,
@@ -94,7 +96,6 @@ public:
bool center;
double x, y, z, h, r1, r2;
- static const double F_MINIMUM = 0.01;
double fn, fs, fa;
primitive_type_e type;
int convexity;
@@ -145,13 +146,13 @@ AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstanti
node->fs = c.lookup_variable("$fs").num;
node->fa = c.lookup_variable("$fa").num;
- if (node->fs < PrimitiveNode::F_MINIMUM) {
- PRINTF("WARNING: $fs too small - clamping to %f", PrimitiveNode::F_MINIMUM);
- node->fs = PrimitiveNode::F_MINIMUM;
+ if (node->fs < F_MINIMUM) {
+ PRINTF("WARNING: $fs too small - clamping to %f", F_MINIMUM);
+ node->fs = F_MINIMUM;
}
- if (node->fa < PrimitiveNode::F_MINIMUM) {
- PRINTF("WARNING: $fa too small - clamping to %f", PrimitiveNode::F_MINIMUM);
- node->fa = PrimitiveNode::F_MINIMUM;
+ if (node->fa < F_MINIMUM) {
+ PRINTF("WARNING: $fa too small - clamping to %f", F_MINIMUM);
+ node->fa = F_MINIMUM;
}
@@ -265,7 +266,7 @@ struct point2d {
static void generate_circle(point2d *circle, double r, int fragments)
{
for (int i=0; i<fragments; i++) {
- double phi = (M_PI*2* (i + 0.5)) / fragments;
+ double phi = (M_PI*2*i) / fragments;
circle[i].x = r*cos(phi);
circle[i].y = r*sin(phi);
}
contact: Jan Huwald // Impressum