From ac4d4d1c1c29e09f2cce9016425ce0260698bb03 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 24 Nov 2004 22:20:42 +0000 Subject: [PATCH] shortcut to is_planar check --- panda/src/egg/eggPolygon.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index c7493b075a..8736195e9c 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/panda/src/egg/eggPolygon.cxx @@ -98,6 +98,12 @@ calculate_normal(Normald &result, CoordinateSystem cs) const { //////////////////////////////////////////////////////////////////// bool EggPolygon:: is_planar() const { + if (size() <= 3) { + // If we don't have more than three vertices, we can't be + // non-planar. + return true; + } + Normald normal; if (!calculate_normal(normal)) { // A degenerate polygon--all of the vertices are within one line,