The functions in this section return either a single coordinate or a set of
coordinates. Each has
a const
and a non-const
version.
The arguments are the same, with one exception:
char
cget_coord()
. Indicates which coordinate should be
returned. Valid values are 'x'
, 'X'
, 'y'
,
'Y'
, 'z'
, 'Z'
, 'w'
, and 'W'
.
char
coords'w'
for world_coordinates
(the default), 'p'
for
projective_coordinates
, 'u'
for user_coordinates
,
and 'v'
for view_coordinates
.
const bool
do_perspprojective_coordinates
, or one of its elements
is to be returned. If true
, the
default, then project()
is called, thereby generating values for
projective_coordinates
. If do_persp is false
, then
projective_coordinates
, or one of its elements, is
returned unchanged, which may sometimes be useful.
const bool
do_applytrue
(the default), apply_transform()
is called,
thereby updating the world_coordinates
. Otherwise, it's not, so
that the values stored in world_coordinates
remain unchanged.
Note that if coords is 'p'
and do_persp is true
,
apply_transform()
will be called in project()
whether do_apply
is true
or false
. If for some
reason, one wanted get projective_coordinates
, or one of its
values, based on the
projection of world_coordinates
without first updating them, one
would have to call reset_transform()
before calling one of
these functions. It would probably be a good idea to save transform
before doing so.
Focus*
fFocus
is to be used for projection.
Only relevant if coords
is 'p'
, i.e.,
projective_coordinates
, or one of its elements, is to be
returned. The default is 0, in which case f points to the global
variable default_focus
.
const unsigned short
projcoords
is 'p'
, i.e.,
projective_coordinates
, or one of its elements, is to be
returned. The default is Projections::PERSP
, which causes the
perspective projection to be applied.
real
factorproject()
. The values of the x and y coordinates in
projective_coordinates
are multiplied by factor.
Only relevant if coords
is 'p'
, i.e.,
projective_coordinates
, or one of its elements, is to be
returned. The default is 1.
Returns one of the sets of coordinates;
world_coordinates
by default. Returns a complete set of coordinates:'w'
forworld_coordinates
,'p'
forprojective_coordinates
,'u'
foruser_coordinates
, or'v'
forview_coordinates
.
Projections::PERSP
, [real factor = 1]]]]]])Returns one
coordinate
, x, y, z, or w, from the set of coordinates indicated (orworld_coordinates
, by default).
Returns the x-coordinate from the set of coordinates indicated (or
world_coordinates
, by default).
Returns the y-coordinate from the set of coordinates indicated (or
world_coordinates
, by default).