Wolfram: GraphicsComplex
GraphicsComplex
GraphicsComplex
is a data structure that efficiently represent
a list of
Graphics Primitive
with shared points.
e.g. a list of polygons of a surface sharing edges and vertexes.
syntax:
GraphicsComplex[ pointList, GraphicsPrimitiveList]
in GraphicsPrimitiveList, the arguments of each graphics primitive, is taken as index to pointList.
Example: Triangles Sharing Edge
(* 3 4 1 2 *) Graphics[ GraphicsComplex[ {{0, 0}, {0, 1}, {1, 0}, {1, 1}}, { {Red, Polygon[{1,2,3}]}, {Green, Polygon[{2,4,3}]}, {Blue, PointSize[ 0.05 ], Point[ {1,2,3,4} ]} } ], Frame -> True ]

Example: Square Polygons Sharing Edge
xgrid = Flatten[ Table[ {x,y}, {x,0,2}, {y,0,2}], 1 ] (* {{0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}} *) (* 7 8 9 4 5 6 1 2 3 *) Graphics[ GraphicsComplex[ xgrid, { EdgeForm[ Red ], Polygon[{1,2,5,4}], Polygon[{2,3,6,5}], Polygon[{4,5,8,7}], Polygon[{5,6,9,8}] } ], Axes -> True ]

Convert GraphicsComplex to Graphics Primitives
use
Normal
to turn a
GraphicsComplex
to list of
Graphics Primitive
gc = GraphicsComplex[ {{0, 0}, {0, 1}, {1, 0}, {1, 1}}, { {Red, Polygon[{1,2,3}]}, {Green, Polygon[{2,4,3}]}, {Blue, PointSize[ 0.05 ], Point[ {1,2,3,4} ]} } ] Normal[ gc ]

Wolfram. Graphics Programing
- Wolfram: Graphics Programing Index
- Wolfram: Graphics Primitive
- Wolfram: Graphics, Graphics3D
- Wolfram: Graphics Directive
- Wolfram: Geometric Transformation Functions
- Wolfram: Apply Transform to Graphics
- Wolfram: Compose Transformations
- Wolfram: Translate Copy Graphics
- Wolfram: Transformation Matrix
- Wolfram: GraphicsComplex
- Wolfram: Mesh Region
- Wolfram: Mesh Region Examples
- Wolfram: Extract Graphics from Plot Functions
- Wolfram: Graphics Misc
- Wolfram: Animation