Example_Shapes

Description

static class Tinman.Demo.Examples.Example_Shapes

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

Build​Absolute


public static method BuildAbsolute → ()

returns → IShape

The built shape.

Builds an absolute shape.

Build​Box


public static method BuildBox → ()

returns → IShape

The built shape.

Builds a box shape.

See also

Shape.Box

Build​Checker​Board


public static method BuildCheckerBoard → ()

returns → IShape

The built shape.

Builds a checkerboard shape.

Build​Circle


public static method BuildCircle → ()

returns → IShape

The built shape.

Builds a circle shape.

See also

Shape.Circle2

Build​Cube


public static method BuildCube → ()

returns → IShape

The built shape.

Builds a cubemap shape.

Build​File


public static method BuildFile → (1)

shp in : Path

[not-null]
Path to a ShapeFormat.SHP file.

returns → IShape

The built shape.

Builds a shape from a file.

See also

Shape.File1

Build​Georef


public static method BuildGeoref → ()

returns → IShape

The built shape.

Builds a shape that is transformed from one coordinate system to another.

Build​Graph


public static method BuildGraph → ()

returns → IShape

The built shape.

Builds a graph shape.

See also

ShapeType.Graph

Build​Group


public static method BuildGroup → ()

returns → IShape

The built shape.

Builds a group shape.

See also

Shape.Group

Build​Invert


public static method BuildInvert → ()

returns → IShape

The built shape.

Builds an inverted shape.

See also

IShapeOps.Invert

Build​Matrix


public static method BuildMatrix → ()

returns → IShape

The built shape.

Builds a shape that is transformed by a matrix.

Build​Maximum


public static method BuildMaximum → ()

returns → IShape

The built shape.

Builds a shape with an aggregated distance field that uses maximum distance values.

Build​Mesh


public static method BuildMesh → ()

returns → IShape

The built shape.

Builds a triangle mesh shape.

See also

ShapeType.Mesh

Build​Minimum


public static method BuildMinimum → ()

returns → IShape

The built shape.

Builds a shape with an aggregated distance field that uses maximum distance values.

Build​Offset


public static method BuildOffset → ()

returns → IShape

The built shape.

Builds a shape with a distance field offset.

See also

IShapeOps.Offset

Build​Points


public static method BuildPoints → (1)

in : int32

[>=1]
The number of points in the soup.

returns → IShape

The built shape.

Builds a point soup shape.

See also

ShapeType.Points

Build​Polygon


public static method BuildPolygon → ()

returns → IShape

The built shape.

Builds a complex polygon shape with a hole.

The internal representation of complex polygon shapes uses indexed geometry and a spatial acceleration structure.

Build​Polygon​Simple​Large


public static method BuildPolygonSimpleLarge → ()

returns → IShape

The built shape.

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.

Build​Polygon​Simple​Small


public static method BuildPolygonSimpleSmall → ()

returns → IShape

The built shape.

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.

Projection​And​Rasterization


public static method ProjectionAndRasterization → (3)

scene in : IScene

[not-null]
The scene to use.

shapes in : ShapeLayer

[not-null]
The shape layer to use.

coordinates in : LatLon

The coordinate where to put the generated shapes.

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.

Write​CSH

2 overloads


[ThrowAny]
public static method WriteCSH1 → (1)

directory in : Path

[not-null]
The output directory.

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


[ThrowAny]
public static method WriteCSH2 → (3)

shape in : IShape

[not-null]
The shape to write.

tag in : string

[not-empty]
The name tag to use.

directory in : Path

[not-null]
The output directory.

Writes all example shapes to the given directory.