Industrial Data Science
in C# and .NET:
Simple. Fast. Reliable.
 
 

ILNumerics - Technical Computing

Modern High Performance Tools for Technical

Computing and Visualization in Industry and Science

tgt

Shapes

Most elementary visual nodes are represented by the simplest basic shapes: points, lines and triangles. They are created from instances of Points, Lines and Triangles. Each of these objects is able to represent an arbitrary number of its shape type. By default, that number is 0.

Except for former versions of ILNumerics, all shape objects are manipulatable in arbitrary ways after creation. for example the number of objects can be increased or decreased at any time.

 

Starting Example

Let's start with a very simple example:

We just created a 3D scene with a single point at (0, 0, 0).

 

Multiple Points

Here, 1000 points were created at normal distributed random positions. In an interactive application, moving the scene with the mouse will make the relations between the points clearer (See: Quick Start Guide)

The Color property of a shape is used to

  • assign a single color to the shape and
  • define this single color.

In order to color all points green, we add:

 

Exercise: It is so easy to change the points to blue. Guess how?

Minimal Shape Configuration

All shapes existing in ILNumerics:

By default, a new shape will not contain any vertices and must be configured from scratch. Minimal configuration includes...

  1. Vertex positions; default: no vertices defined, empty Positions buffer
  1. Color; default: no single Color defined, no individual vertex colors defined/ empty Colors buffer
 

Predefined Shapes

Since even the configuration of simple shapes can become cumbersome, a number of predefined shapes exist for easy and efficient use. All predefined shapes exist as static members of the ILNumerics.Drawing.Shapes class – each in a simple and common configuration. The collection includes variants of the simplest shapes (triangles, lines, points), shapes like circles, rectangles, cubes and more complex shapes like spheres, cylinders, rods, cones, and gears. Most shapes exist as filled shapes (triangles) and as wireframes (lines).

Shapes, which are fetched from the Shapes collection are individually configurable. In most situations they are used as a starting point for own configurations. In order to create – let’s say – a number of lines, one may start with Shapes.Line which produces a single line and uses the Positions, Colors and/or Indices buffers to configure more vertices, hence producing more lines.

The following statements both produce the same result: a pentagon. The first example starts with a predefined line from the Shapes collection, the other starts with a plain empty Lines shape. Both are completely interchangeable: 

Predefined shapes only provide a simple way to create and use very simple shapes. In most situations, further configuration will be necessary. This includes the definition of buffer data as seen in the pentagon example. The next section will go into more detail on Buffers