added Polygon::add(), Polygon::containsPoint(); initial attempt at rendering Extrude objects
git-svn-id: svn://anubis/fart/trunk@272 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
b51d11d043
commit
7bac2fb076
4 files changed
+94
-2
No files matched your search
+6
-2
@@ -642,15 +642,19 @@ refptr<Polygon> Scene::processNGon(refptr<Node> node)
|
||||
refptr<Polygon> p = new Polygon();
|
||||
double radius = node->getChildren()[0]->getNumber();
|
||||
int n = node->getInteger();
|
||||
int step = n < 0 ? -1 : 1;
|
||||
n = abs(n);
|
||||
if (n < 3)
|
||||
n = 3;
|
||||
int pos = 0;
|
||||
double astep = 2.0 * M_PI / n;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
p->push_back(new Vector(
|
||||
radius * cos(i * astep),
|
||||
radius * sin(i * astep),
|
||||
radius * cos(pos * astep),
|
||||
radius * sin(pos * astep),
|
||||
0.0));
|
||||
pos += step;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user