For version 0.7.0.
To top.  Up: ..Shapes


Core bindings
facet facing newGroup newLights newZBuf newZSorter null

Summary of extensions
..Shapes..Graphics3D / arrowheads
triangleArrow twoCirclesArrow
..Shapes..Graphics3D / metapostarrow

A 3d graphical object in Shapes is basically something that ca be projected to 2d, and then results in a 2d graphical object. This namespace is also used for the border between the 2d and 3d graphical worlds, so that ..Shapes..Graphics doesn't get disturbed by the things that only concern those that work with 3d scenes.
Separation of 2d and 3d concerns in its current form was initiated with the introduction of namespaces in Shapes, and this separation is still work in progress. This means that even when working purely in 3d, it is still necessary to use contents of the ..Shapes..Graphics namespace from time to time. The function is a typical such example; it still follows the old design where a single function is used for both 2d and 3d.
Sections:    Elementary 3d    Facets    Scenes and light    Quasi 3d

Elementary 3d

The analogue of ..Shapes..Graphics..null, but in 3d instead of 2d.
This is a hot value.


path::§Path n1::§N n2::§N n3::§N tiebreaker:0::§Length double::§Boolean §Drawable3D
Type of surface normal. Should either be §SurfaceNormalGray or §SurfaceNormalRGB.
Dynamic references:none
The only required argument is path, which must be a flat polygon. The three arguments of type §N will be described shortly. The parameter tiebreaker has the same meaning as for ..Shapes..Graphics..fill, and double tells whether the surface should be visible when viewed from the back. Surfaces that are not visisble when viewed from the back allow more efficient rendering when they cover a solid body, so that one knows that the inside of the body surface should never be visible. The default value for double depends on the presence of surface normals; if there are none, it defaults to true, otherwise it defaults to false unless the surface normals disagree on which is the visible side.
Up to three surface normals may be provided (provide n1 before n2 and so forth). A surface normal has a location on the surface and specifies both a normal direction to be used in light computations (although the surface is physically flat, it can be treated as if curved in the light model), and a color. See facetnormal for more details on how to construct surface normals. If no facet normal is provided, one is computed by using the physical normal direction of path, with color determined by ..Shapes..Traits..@nonstroking. If just one facet normal is provided, it defines a constant normal direction and color over the whole facet. If more than one is provided, normal direction and color are interpolated over the facet.
Please refer to the documentation on the many dynamic variables accessed by this function, to learn how these affect the light computations.

Scenes and light

This is a hot value.
This is a hot value.
This is a hot value.

Quasi 3d

obj::§Drawable scale:false::§Boolean distort:false::§Boolean §Drawable3D
Make a special kind of 3d object at z = 0, which will always face the viewer even after 3d transforms. It is useful for labels and other 2d annotations that need to be positioned in terms of objects in a 3d world.
When the object is viewed after being transformed in 3d, it will just be transformed by a 2d transform, so the object never has to go truly 3d. The object will be shifted according to how its origin moved by the 3d transform. The arguments scale and distort determine how the linear part of the 2d transform is obtained from the 3d transform. If scale is set, the object will be scaled according to the z coordinate of its transformed origin. If distort is set, the linear (x,y) part of the 3d transform will be used.
obj::( ::§Transform3D  §Drawable ) §Drawable3D
Dynamic references:<The entire dynamic state>
Gives the user full control of how to display the object when being viewed through a 3d transform. The dynamic state is captured, and will be in scope later when the embedded function is invoked.
The evaluation order is quite non-standard for the objects created here. Viewing an object is generally an atomic operation from a continuation passing point of view. Hence, when the function is applied to the transform to obtain the 2d result, this will take place in an evaluation loop of its own. This is very likely to render generated error messages rather useless when it comes to localizing the problem.
Since the object created here only has a meaning when being viewed, it cannot be searched (see ..Shapes..Graphics..Tag..tag and ..Shapes..Graphics..Tag..find) for tags as long as it remains in 3d.
If you ever considered solving the intricate problem of generating nice arrowheads for paths in 3d by simply treating the path as if it was in 2d, think again, as the example below shows!

Source: show/hide visit
Get Shapes at Fast, secure and Free Open Source software downloads