Example_Shapes
Description
Full source code is included in the Tinman 3D SDK download. |
This example shows how to the IShape API.
The Build*
methods demonstrate how to build shapes.
Public / Methods
BuildMaximum
Builds a shape with an aggregated distance field that uses maximum distance values.
- See also
BuildMinimum
Builds a shape with an aggregated distance field that uses maximum distance values.
- See also
BuildPolygon
Builds a complex polygon shape with a hole.
The internal representation of complex polygon shapes uses indexed geometry and a spatial acceleration structure.
- See also
BuildPolygonSimpleLarge
Builds a simple polygon shape without holes and a large number of vertices.
The internal representation of simple polygon shapes with many vertices uses non-indexed geometry and a spatial acceleration structure.
- See also
BuildPolygonSimpleSmall
Builds a simple polygon shape without holes and a small number of vertices.
The internal representation of simple polygon shapes with few vertices uses non-indexed geometry and no spatial acceleration structure.
- See also
ProjectionAndRasterization
Generates some vector shapes to illustrate how spatial distortions relate to the coordinate system that is used by shapes.
Centered at the given coordinates, some heightmap shapes and pixel pyramid shapes are generated using scene in and added to shapes in:
-
RED:
Oblique stereographic projection, shape features defined by distance offset -
GREEN:
Oblique stereographic projection, shape features defined via plain geometry -
BLUE:
Cubemap projection, shape features defined by distance offset -
YELLOW:
Cubemap projection, shape features defined via plain geometry -
CYAN:
Geographic coordinates, shape features defined by distance offset -
MAGENTA:
Geographic coordinates, shape features defined via plain geometry
The recommended way for putting shapes onto the terrain in an accurate way is via the RED and GREEN approaches, using any appropriate map projection for the task at hand (for example IScene.Topocentric).
The BLUE approach is not recommended, as it suffers from distortions that are inherent to the cubemap projection and thus cannot be avoided: for example, circles becoming ovals and line thickness varying by up to 50%.
The YELLOW approach should only be used if the distortion of the distance field is not of relevance: for example, when using distance offsets for visual shape styles for which varying line thickness (see BLUE) is not a concern.
The CYAN and MAGENTA approaches should only be used for use-cases where high accuracy is not required. For non-equator locations, the axes of a geographic coordinate system will have different scales in the geocentric frame, so circles will become ovals and line thickness may vary.
WriteCSH
2 overloads
Writes all example shapes to the given directory.
This method will call BuildFile and pass a path to a file named polygon.shp
, which must be present in the given directory in. Any shapefile will do, but the original reference shapefile may be downloaded from here:
https://github.com/paleolimbot/shp/blob/master/inst/shp/polygon.shp
Writes all example shapes to the given directory.