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):

i1 : a=Circle{Radius=>1}; b=Circle{[1,1],Radius=>1}; mid=a.Center+b.Center

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

GraphicsCoodinates can also be manipulated using various operations such as addition, multiplication by scalar, etc. Any GraphicsObject can be turned into a GraphicsCoordinate corresponding to the reference point $(0,0,0,1)$ in its local coordinate system. Though one can perform the conversion from GraphicsObject to GraphicsCoodinates explicitly using "new... from...", one rarely needs 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. For example, the same example can be written

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

o7 = mid

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

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

o8 : 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.

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

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

o10 : GraphicsList

For the programmer

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