3 Shape Attributes
Every occupied point in 3D space has associated attributes.
The attributes that Pict3D manages, which influence rendering, are reflected color, emitted color,
and material.
New
Pict3D instances set their shapes’ attributes using the values of these parameters.
Return new
Pict3D instances with the attributes of every shape changed.
3.1 Reflected Color Attributes
The type and predicate of reflected colors with optional transparency.
Constructs an
RGBA value from its components, or converts a color in another representation
to an
RGBA.
If
color already has an alpha component, it is multiplied by
alpha in the result.
Examples:
> (rgba "white") |
(rgba 1.0 1.0 1.0 1.0) |
> (rgba "white" 0.5) |
(rgba 1.0 1.0 1.0 0.5) |
> (rgba (rgba "white") 0.5) |
(rgba 1.0 1.0 1.0 0.5) |
> (rgba 1/2) |
(rgba 0.5 0.5 0.5 1.0) |
> (rgba 0.2 0.3 0.4) |
(rgba 0.2 0.3 0.4 1.0) |
> (rgba '(1/2 1/4 1/8)) |
(rgba 0.5 0.25 0.125 1.0) |
> (rgba #(1/2 1/4 1/8)) |
(rgba 0.5 0.25 0.125 1.0) |
> (rgba (flvector 0.5 0.25 0.125)) |
(rgba 0.5 0.25 0.125 1.0) |
All component values are converted to flonums and clamped to the range [0,1].
Return the components of rgba.
> (match-define (rgba r g b a) (rgba "lavender" 0.75)) |
|
> (list r g b a) |
'(0.9019607843137255 0.9019607843137255 0.9803921568627451 0.75) |
3.2 Emitted Color Attributes
The type and predicate of emitted colors, which include red, green, blue and intensity components.
Constructs an
Emitted value from its components, or converts a color in another
representation to an
Emitted.
If
color already has a fourth component, it is multiplied by
intensity in the
result.
All component values are converted to flonums, set to 0.0 if negative, and normalized so
that the largest of red, green and blue is 1.0.
Examples:
> (emitted "blue") |
(emitted 0.0 0.0 1.0 1.0) |
> (emitted "darkblue") |
(emitted 0.0 0.0 1.0 0.5450980392156862) |
Return the components of emitted.
> (match-define (emitted r g b i) (emitted 1 2 3 1)) |
|
> (list r g b i) |
'(0.3333333333333333 0.6666666666666666 1.0 3.0) |
3.3 Material Attributes
The type and predicate of materials, which include ambient, specular, diffuse, and roughness
components.
(material | [ | #:ambient ambient | | | | | | | #:diffuse diffuse | | | | | | | #:specular specular | | | | | | | #:roughness roughness]) | | → | | Material |
|
ambient : Real = 0 |
diffuse : Real = 0 |
specular : Real = 0 |
roughness : Real = 0.1 |
Contructs a material from its components.
For realistic-looking materials, ambient, diffuse and specular should sum
to 1 (but this is not enforced).
The x-axis sphere has only ambient reflectance. It reflects an imaginary white
light in all directions with the same intensity.
The y-axis sphere has only diffuse reflectance. It looks dull; not shiny at all.
The z-axis sphere has only specular reflectance. It looks only shiny.
The roughness component affects only specular reflectance.
Generally, the less rough the sphere, the shinier it looks.
Return the components of material.
3.4 Vertex Attributes
The functions triangle and quad accept not just position arguments, but
vertex arguments that contain positions and can override any current shape attributes.
Examples:
The type and predicate of
vertex data.
(vertex | | pos | | | | | | [ | #:normal normal | | | | | | | #:color color | | | | | | | #:emitted emitted | | | | | | | #:material material]) | | → | | Vertex |
|
pos : Pos |
normal : (U #f Dir) = #f |
color : (U #f RGBA) = #f |
emitted : (U #f Emitted) = #f |
material : (U #f Material) = #f |
Return the attributes of vertex.
3.5 Interval Arguments
The type and predicate of closed intervals.
Constructs an
Interval value from its endpoints.
Endpoints may be given in either order and are converted to flonums.
Examples:
> (interval 0 -1) |
(interval -1.0 0.0) |
> (interval -inf.0 +inf.0) |
(interval -inf.0 +inf.0) |
Common intervals.
Return the endpoints of i.
3.6 Arc Arguments
The type and predicate of closed arcs.
Constructs an
Arc value from its start and end angles.
Angles are converted to flonums and normalized so that
start is in [0,360) and
end
is no less than
start.
Examples:
> (arc 0 0) |
(arc 0.0 0.0) |
> (arc 0 360) |
(arc 0.0 360.0) |
> (arc -90 90) |
(arc 270.0 450.0) |
> (arc 90 -90) |
(arc 90.0 270.0) |
> (arc 0 450) |
(arc 0.0 90.0) |
Common arcs.
Return the start and end angles of a.