Whether using a retained mode or an immediate mode graphics API, the programmer must specify the geometry that the API eventually draws onto a pixel buffer. A pixel buffer is a two-dimensional array of pixels. Those pixels are most naturally referenced by integer indices. '''How do you represent geometry in a graphics API? Do you use DiscreteCartesianGeometryPrimitives or ContinuousCartesianGeometryPrimitives?''' One or more of these applies: * The API will run on machines with a graphics hardware accelerator. Graphics hardware will usually perform geometry calculations on floating point values. * The API will make it easy to apply affine transformations to the drawn geometry. For example, rotating/scaling/shearing the geometry primitives. The API might use a SceneGraph or SingleTransform model to specify transformations. * The API will antialias the geometry that it renders, thereby simulating drawing between the actual pixels. Therefore: '''Represent geometry using floating point values.''' Affine transformations such as scaling down or rotation will translate integer coordinates to floating point coordinates within the implementation of the API or in the graphics hardware itself. Representing geometry using floating point at the API level provides more flexibility to the user of the API. However, floating point coordinates can introduce rounding errors. For example, 0.1 (decimal) is a recurring fraction in binary. Floating point numbers also introduce inaccuracy at the large and small scales. Some 3D APIs, such as Java3D, provide numeric types that can represent very large or very small numbers to get around this problem. ---- What about FixedPointCartesianGeometryPrimitives? ---- Also see GraphicsPatterns. CategoryGraphicsPattern CategoryPattern