Listing 1
Vertices and Triples
const
MaxPlys = 8;
MaxEdgeLength = 1 shl (MaxPlys - 1);
type {2D vertex 'names'}
GridCoordinate = 0..MaxEdgeLength; { Triangular grid space }
TVertex = record
AB, BC, CA: GridCoordinate;
end;
function Vertex(AB, BC, CA: GridCoordinate): TVertex;
begin
Result.AB := AB;
Result.BC := BC;
Result.CA := CA;
end;
type {3D vertex values}
Coordinate = -30000..30000;
TTriple = record
X, {Width: 0 (left) to UnitLength (right)}
Y, {Depth: 0 (front) to UnitLength (back)}
Z: Coordinate; {Height: 0 (bottom) to UnitLength (top)}
end;
function Triple(X, Y, Z: TCoordinate): TTriple;
begin
Result.X := X;
Result.Y := Y;
Result.Z := Z;
end;
type {2D screen coordinates}
TPixel = TPoint;