Macaulay2 » Documentation
Packages » VectorGraphics :: GraphicsCoordinate
next | previous | forward | backward | up | index | toc

GraphicsCoordinate -- A type for coordinates

Description

A type that is used to describe (possibly dynamic) coordinates. Internally all coordinates are in $\RR^4$ (projective coordinates). Any GraphicsObject can be turned into a GraphicsCoordinate corresponding to the reference point $(0,0,0,1)$ in its local coordinate system. GraphicsCoodinates can also be manipulated using various operations such as addition, multiplication by scalar, etc. Though you can perform the conversion from GraphicsObject to GraphicsCoodinates explicitly using "new... from...", you do not ever need to do so since this conversion is performed automatically if you use a GraphicsObject as coordinate inside another object, or apply arithmetic operations to it. A convenient way to define GraphicsCoodinates is via gNode.

i1 : a=gNode([0,0],Circle{Radius=>1}); b=gNode([1,1],Circle{Radius=>1}); mid=a+b

o3 = mid

o3 : GraphicsCoordinate
i4 : gList(a,b,Circle{mid,Radius=>1-1/sqrt 2})

o4 = GraphicsList{cache => CacheTable{}                                  }
                  Contents => {a, b, Circle{cache => CacheTable{}      }}
                                            Center => mid
                                            Radius => .292893
                                            style => MutableHashTable{}
                  style => MutableHashTable{}

o4 : GraphicsList

Note that any object that the GraphicsCoodinate depends on must be provided explicitly as part of the picture, even if that object happens to be "invisible". In the example that follows, a is an empty graphical object, yet it must be included in the gList for the animation to work correctly.

i5 : a=gNode([0,1],AnimMatrix=>rotation 0.1);
i6 : gList(a,Circle{Radius=>1},Polygon{{a,[-1,0],[1,0]}})

o6 = GraphicsList{cache => CacheTable{}                                                                                            }
                  Contents => {a, Circle{cache => CacheTable{}      }, Polygon{cache => CacheTable{}                             }}
                                         Center => | 0 |                       PointList => {GraphicsCoordinate a, | -1 |, | 1 |}
                                                   | 0 |                                                           |  0 |  | 0 |
                                                   | 0 |                                                           |  0 |  | 0 |
                                                   | 1 |                                                           |  1 |  | 1 |
                                         Radius => 1                           style => MutableHashTable{}
                                         style => MutableHashTable{}
                  style => MutableHashTable{}

o6 : GraphicsList

For the programmer

The object GraphicsCoordinate is a self initializing type, with ancestor classes GraphicsAncestor < HashTable < Thing.