⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polygon.h

📁 [Game.Programming].Academic - Graphics Gems (6 books source code)
💻 H
字号:
// -*- C++ -*-// polygon.h by George Vanecek Jr, June 1994#ifndef _POLYGON_H_#define _POLYGON_H_#ifndef _LIST_H_#include "list.h"#endif#ifndef _PLANE_H_#include "plane.h"#endif#ifndef _DEDGE_H_#include "dedge.h"#endifclass Polygon {public:  Polygon( const Counter nPoints, const Point [] );  Counter    nPoints( ) const { return nDEdges; }  const Plane& plane( ) const { return supportPlane; }  DEdge*       first( ) const { return anchor; }private:  Polygon( DEdge* const, const Plane& );  Where   classifyPoints( const Plane&, Counter&, DEdge*[] );  void    addBridge     ( DEdge* const, DEdge* const );  void    complexCut    ( const Plane&, const Counter, DEdge* const [],			  List<Polygon>&, List<Polygon>& );  static void sortDEdges( const Counter, DEdge* const [], const Vector& );  void    maximize      ( DEdge* const );  void    split         ( const Plane&, DEdge* const );  const Plane supportPlane;  Counter     nDEdges;		// Number of DEdges in loop...  DEdge*      anchor;		// Edge Loopfriend void split( Polygon*&, const Plane& cut,		   List<Polygon>& above,		   List<Polygon>& on,		   List<Polygon>& below );};// Juxtapose two strings to form a single identifier:#define name2(a,b) a##b// Iterate over all Directed Edges within a Polygon member function:#define forEachDEdge(d) \       for( DEdgePtr d = first(), name2(last,d) = NULL;\	    d != first() || name2(last,d) == NULL;\	    name2(last,d) = d, d = d->next() )// Iterate over all Directed Edges of a Polygon *g:#define forEachDEdgeOfPoly(d,g) \       for( DEdgePtr d = g->first(), name2(last,d) = NULL;\	    d != g->first() || name2(last,d) == NULL;\	    name2(last,d) = d, d = d->next() )#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -