Prisms in GDTF are part of a Wheel and in particular, they are inside of what is called a Wheel Slot. Prisms definitions in GDTF allow precise definition of each prism facet and it is done by using transformations represented by Rotation matrices. There are many resources on rotation matrices, for example this Wikipedia article and also many game engine related tutorials and articles, like this one, which is useful for our 2D prism definitions.
In the GDTF Builder, there is a really nice Prism editor which can do some of the math for you, like rotations and transformation (movement):
The editor also allows you to visualize multiple facets at the same time and show a circular view, which is useful for checking the final result. Here you can see linear and circular prism represented by the Rotation matrix and also visually:
When defining prisms/prism facets, it is good to know how the Rotation matrix works or at least what each field means. Here i labeled the fields important for prism definition:
It is important to know what are the units used for the transformation. For the sake of simplicity, we can say here that the unit used in the matrix is "the radius of the unaltered beam". This sounds weird, so lets make an example:
Let's say, that we want to define a linear prism, which looks like this:
We need to define three beams.
First one in an unaltered form, so horizontal and vertical scale are 1, and there is no rotation and no offset (translation):
Now we define one facet to the left, touching the first beam. As the translation is to the left (negative) and it it 2x the radius of the unaltered beam, we enter -2 into the Horizontal translation field:
Now, we define the facet to the right, just touching the first beam. As the translation is 2x the radius of the unaltered beam, we enter 2 into the Horizontal translation field:
So anytime we want to move the beam from the original position, we simply use the original beam as the reference. Of course, in real life, we will need to do a bit of math, here is a practical example:
Linear 4-facet prism
Measured projection on a wall:
Unaltered beam diameter: 53
Offset of beam centers from center of unaltered beam, facets 1,2,3,4: -99, 30, 30, 99
Vertical translation:
facet 3: 30/53*2 = 1.1320754716981132
facet 4: 99/53*2 = 3.7358490566037736
facet 1: negative value of facet 4
facet 2: negative value of facet 3
Horizontal and vertical Scale:
If the altered beam was different, for example 55: 55/53=1.0377358490566038
Resulting preview:
And the definition:
Circular prisms
The Builder Prism facet editor contains a handy tool to define what is the offset of the facets from the center and will calculate parameters for the desired number of facets placed in a circle around the center:
Here is the initial generated result (preview):
And the definition:
But you must pay attention also to the rotation of each facet. The above example shows us that some facets are actually rotated:
Which we must adjust by using the Rotate tool on each of the facets where this is required (-90, -180, -270):
To achieve our final look:
And definition:
Now you have a basic understanding on how to define prism facets in GDTF.