Most elementary visual nodes are represented by the simplest basic shapes: points, lines and triangles. They are created from instances of ILPoints, ILLines and ILTriangles. 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.
Let's start with a very simple example:
We just created a 3D scene with a single point at (0, 0, 0).
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...
- Vertex positions; default: no vertices defined, empty Positions buffer
- Color; default: no single Color defined, no individual vertex colors defined/ empty Colors buffer
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 ILLines 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.