docs/csg.js
function(orthobasis) {
            var points2d = this.vertices.map(function(vertex) {
                return orthobasis.to2D(vertex.pos);
            });
            var result = CAG.fromPointsNoCheck(points2d);
            var area = result.area();
            if (Math.abs(area) < 1e-5) {
                // the polygon was perpendicular to the orthnormal plane. The resulting 2D polygon would be degenerate
                // return an empty area instead:
                result = new CAG();
            } else if (area < 0) {
                result = result.flipped();
            }
            return result;
        }
function(orthobasis) {
            var points2d = this.vertices.map(function(vertex) {
                return orthobasis.to2D(vertex.pos);
            });
            var result = CAG.fromPointsNoCheck(points2d);
            var area = result.area();
            if (Math.abs(area) < 1e-5) {
                // the polygon was perpendicular to the orthnormal plane. The resulting 2D polygon would be degenerate
                // return an empty area instead:
                result = new CAG();
            } else if (area < 0) {
                result = result.flipped();
            }
            return result;
        }
function ( orthobasis ) { var points2d = this . vertices . map ( function ( vertex ) { return orthobasis . to2D ( vertex . pos ) ; } ) ; var result = CAG . fromPointsNoCheck ( points2d ) ; var area = result . area ( ) ; if ( Math . abs ( area ) < 1e-5 ) { // the polygon was perpendicular to the orthnormal plane. The resulting 2D polygon would be degenerate // return an empty area instead: result = new CAG ( ) ; } else if ( area < 0 ) { result = result . flipped ( ) ; } return result ; }
project the 3D polygon onto a plane
project the 3D polygon onto a plane