WolframLang: GraphicsComplex
GraphicsComplex
GraphicsComplex
is a data structure that efficiently represent
a list of
Graphics Primitives
with shared points.
e.g. typically, a list of polygons of a surface will share edges and vertexes.
syntax:
GraphicsComplex[ ListOfPoints, ListOfGraphicsPrimitives]
in ListOfGraphicsPrimitives, any argument of graphics primitives, is taken as index to ListOfPoints.
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 Primitives
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 ]
WolframLang, Graphics Programing
- WolframLang: Plot and Visualization
- WolframLang: Graphics Primitives
- WolframLang: Graphics Directives
- WolframLang: Extract Graphics from Plot
- WolframLang: Geometric Transformation Functions
- WolframLang: Compose Transformations
- WolframLang: Apply Transform to Graphics
- WolframLang: Translate Copy Graphics
- WolframLang: Transformation Matrix
- WolframLang: GraphicsComplex
- WolframLang: Mesh Region
- WolframLang: Graphics Misc
- WolframLang: Animation