view | |
---|---|
::§Geometric3D → §Geometric | |
Dynamic references: | none |
Apply pin-hole camera projection. The geometry of the projection is documented under @eyez.
Exactly how 3d objects, if they can at all, behave when being projected, depend on the exact object type. §Drawable3D objects will result in §Drawable objects, the operation is generally very complicated if occlusions are to be taken into account. (What makes it difficult is that Shapes deals with scalable graphics, and cannot resort to a pixel z-buffer.) There are three 3d graphics container types with different behaviors. First, §Group3D takes no consideration of occlusions, and just puts the projections of its part on top of each other in the order in which they appear in the data structure. The two remaining types tries to respect occlusions, and the reader is referred to the documentation of these types to find out more about their algorithms, see §ZBuffer and §ZSorter.
| |
See also: | immerse |
@eyez | |
---|---|
Used by: | |
Type: | §Length |
Default binding: | 50 cm |
Constraint: | @eyez > 0 bp or @eyez = ∞ |
When a 3d world is viewed through a pin-hole camera to obtain 2d image, the pin-hole camera (the eye) is located at ( 0, 0, zeye ), and the image plane is z = 0. The special float value ∞ can be used to place the eye at infinity, which will make the projection independent of z coordinates.
|
immerse | |
---|---|
::§Geometric → §Geometric3D | |
Dynamic references: | none |
Move object from 2d to 3d by equipping it with a z = 0 coordinate. The operation is reversed by view.
|
coords | |
---|---|
::§Float ::§Float ::§Float → §FloatTriple | |
Dynamic references: | none |
Implements float-triple.
| |
::§LengthLike ::§LengthLike ::§LengthLike → §Coords3D | |
Dynamic references: | none |
Implements coords-3D.
Note that all arguments must be §LengthLike, with no exception.
|
orthogonal | |
---|---|
::§FloatTriple → §FloatTriple | |
Dynamic references: | none |
Produces vector which is orthogonal to the given one. The funciton preserves norm, but the argument must not have zero length.
The direction of the result is computed as a cross product with either the x or the y basis vector, depending on which one is less parallel to the argument.
|
affinetransform | |
---|---|
::§FloatTriple ::§FloatTriple ::§FloatTriple ::§Coords3D → §Transform3D | |
Dynamic references: | none |
Construct transform from multiplier for x, y, and z coordinates, followed by a shift. |
shift | |
---|---|
::§Coords3D → §Transform3D | |
Dynamic references: | none |
Construct transform. |
rotate | |
---|---|
dir::§FloatTriple angle::§Float → §Transform3D | |
Dynamic references: | none |
Construct rotation transform about given direction. |
scale | |
---|---|
r:1::§Float x:1::§Float y:1::§Float z:1::§Float → §Transform3D | |
Dynamic references: | none |
Construct transform that scales x by r*x, and similarly with y and z. |
inverse | |
---|---|
::§Transform3D → §Transform3D | |
Dynamic references: | none |
Constructs the inverse of a transform. This is only possible if the linear part of the transform is non-singular. |
Schur_decomp | |||||||||
---|---|---|---|---|---|---|---|---|---|
tf::§Transform3D rank::§Integer canonical:false::§Boolean →
(> | |||||||||
Computes a rigid body coordinate transform that brings the transform tf into a simple form. The linear part of the coordinate transform is given by the real Schur decomposition, ensuring that a real eigenvalue is associated with the third basis vector. (Hence, if there is a 2 by 2 block in the Schur form, it will be in the upper left part.) The translational part of the coordinate transform is computed to make the translational part in the new coordinates small. The rank parameter determines how many equation to use when the translational part is computed. If rank is not provided, it is determined automatically from singular values. A rank of zero means that the translational part of the coordinate transform shall not be used at all. If canonical is set, the coordinate transform is made special (that is, it preserves orientation), and if there is an extra degree of freedom in the coodinate transform due to complex eigenvalues in the linear part of tf, it is used to minimize the angle of rotation in the coordinate transform.
Note that the rank shall not be selected full (that is, 3) if tf is a rigid body transformation; use 2 if the rotation is not close to zero, and 0 otherwise (or use the automatic selection). Compare Chasles' theorem, which says that the new transform will in general have a non-trivial translational part.
This function may be used to find a rotation's eigenvector (that is, the direction of the rotation), as the eigenvector will be in the third column of the linear part of the change of coordinates.
tf: [rotate angle:25° dir:(1,2,3)] •stdout << [Schur_decomp tf].Q.Lz
|