next | previous | forward | backward | up | top | index | toc | Macaulay2 website
VectorGraphics :: Light

Light -- A source of light

Description

A source of light for a 3d SVG picture. This corresponds to the SVG "specular" lighting, use the property Specular. The location is given by Center. By default a Light is invisible (it has opacity 0) and is unaffected by matrix transformations outside it (Static true).

i1 : Light{"fill"=>"yellow","opacity"=>1}

o1 = Light{Blur => .3                        }
           cache => CacheTable{}
           Center => | 0 |
                     | 0 |
                     | 0 |
                     | 1 |
           Radius => 10
           Specular => 64
           Static => true
           style => MutableHashTable{...3...}

o1 : Light
i2 : v={[74.5571, 52.0137, -41.6631],[27.2634, -29.9211, 91.4409],[-81.3041, 57.8325, 6.71156],[-20.5165, -79.9251, -56.4894]};
i3 : f={{v#2,v#1,v#0},{v#0,v#1,v#3},{v#0,v#3,v#2},{v#1,v#2,v#3}};
i4 : c={"red","green","blue","yellow"};
i5 : tetra=gList(apply(0..3,i->Polygon{f#i,"fill"=>c#i,"stroke"=>"none"}),
         Light{[110,0,0],Radius=>10,"opacity"=>"1"},ViewPort=>{vector{-110,-100},vector{110,100}},
         Size=>40,TransformMatrix=>rotation(-1.5,[4,1,0]))

o5 = tetra

o5 : GraphicsList

Caveat

Do not use the same Light object multiple times within the same GraphicsObject.

For the programmer

The object Light is an instance of the type GraphicsType, with ancestor classes Circle < Ellipse < GraphicsObject < GraphicsAncestor < HashTable < Thing.