• Files
  • Threads
  • Codex
  • Geometry 2D
  • Properties

  • Arrays
  • Strings
  • Primitives
  • Exceptions
  • Time



Geometry 2D

The geometry classes were the easiest to write after I made the decision to build from the APIs my apps were using down to the macOS and Windows hosts. They were also the first I finished. The primitives herein pretty much align with what Taligent's Albert project had, though some of the names changed a bit. The simplest classes explicitly avoid virtual functions and avoid allocating memory. As such they do not require a virtual constructor and as a convenience they offer public members. The idea was those public members weren't going to change. Thirty three years later (as of August 2021) that idea still holds. All of the geometries are based on the special type Coord. It is used for all geometric members and parameters. Coord equates to the Guildhall scalar type fdual and that in turn to the 64-bit floating point type. Here are the geometry primitives.


Primitive

Description

TPoint

a 2D point with public members fX and fY

TRPoint

a 2D point with public members fX, fY, and the rational value fW

TLine

a 2D line with public TPoint members fStartPoint and fEndPoint

TRect

a 2D rectangle with public members fLeft, fTop, fRight, and fBottom

TEllipse

a 2D ellipse with a public TRect member fBounds

TRoundRect

a 2D rounded rectangle with a public TRect member fBounds and a public TPoint member fCurvature

TPointArray

an array of TPoint instances

TRPointArray

an array of TRPoint instances

TPolyline

a subclass of TPointArray that manages the polyline geometry

TPolygon

a subclass of TPolyline that adds the winding number boolean and closes the polyline to effect polygon geometry

TCurve

a subclass of TRPointArray that adds a knot vector and curve order to manage a NURB curve geometry

TShape

a subclass of TCurve that adds the winding number boolean and closes the curve to effect NURB shape geometry


The knot vector used in the TCurve class is a TCoordArray, discussed in the Arrays section.

Additonal Constructible Classes

  • TPath (experimental)
  • TRectArray (utility class)

 

Copyright © 1981-2021 Arthur W Cabral. All Rights Reserved. All referenced trademarks are the property of their respective owners. This site does not use cookies. This site does not collect visitor information. The ISP hosting this site collects statistics regarding visitors to this site as part of the normal operation of the website. We do not currently examine those statistics. If that changes, this notice will change. Mac and macOS are registered trademarks of Apple, Inc. Windows is a registered trademark of Microsoft, Inc.