Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/egg/eggPolygon.I

Go to the documentation of this file.
00001 // Filename: eggPolygon.I
00002 // Created by:  drose (10Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: EggPolygon::Constructor
00023 //       Access: Public
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 INLINE EggPolygon::
00027 EggPolygon(const string &name) : EggPrimitive(name) {
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: EggPolygon::Copy constructor
00032 //       Access: Public
00033 //  Description:
00034 ////////////////////////////////////////////////////////////////////
00035 INLINE EggPolygon::
00036 EggPolygon(const EggPolygon &copy) : EggPrimitive(copy) {
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: EggPolygon::Copy assignment operator
00041 //       Access: Public
00042 //  Description:
00043 ////////////////////////////////////////////////////////////////////
00044 INLINE EggPolygon &EggPolygon::
00045 operator = (const EggPolygon &copy) {
00046   EggPrimitive::operator = (copy);
00047   return *this;
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: EggPolygon::recompute_polygon_normal
00052 //       Access: Public
00053 //  Description: Recalculates the normal according to the order of the
00054 //               vertices, and sets it.  Returns true if the normal is
00055 //               computed correctly, or false if the polygon is
00056 //               degenerate and does not have a normal.
00057 ////////////////////////////////////////////////////////////////////
00058 INLINE bool EggPolygon::
00059 recompute_polygon_normal(CoordinateSystem cs) {
00060   Normald normal;
00061   if (calculate_normal(normal, cs)) {
00062     set_normal(normal);
00063     return true;
00064   }
00065   clear_normal();
00066   return false;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: EggPolygon::triangulate_into
00071 //       Access: Public
00072 //  Description: Subdivides the polygon into triangles and adds each
00073 //               one to the indicated container.  If the polygon is
00074 //               already a triangle, adds an exact copy of the polygon
00075 //               to the container.  Does not remove the polygon from
00076 //               its existing parent or modify it in any way.
00077 //
00078 //               Returns true if the triangulation is successful, or
00079 //               false if there was some error (in which case the
00080 //               container may contain some partial triangulation).
00081 //
00082 //               If convex_also is true, both concave and convex
00083 //               polygons will be subdivided into triangles;
00084 //               otherwise, only concave polygons will be subdivided,
00085 //               and convex polygons will be copied unchanged into the
00086 //               container.
00087 ////////////////////////////////////////////////////////////////////
00088 INLINE bool EggPolygon::
00089 triangulate_into(EggGroupNode *container, bool convex_also) const {
00090   PT(EggPolygon) copy = new EggPolygon(*this);
00091   return copy->triangulate_poly(container, convex_also);
00092 }

Generated on Fri May 2 00:37:51 2003 for Panda by doxygen1.3