axiom-developer
[Top][All Lists]

## Re: [Axiom-developer] Anyone familiar with Xy-pic? (resend)

 From: C Y Subject: Re: [Axiom-developer] Anyone familiar with Xy-pic? (resend) Date: Fri, 11 Nov 2005 20:49:48 -0800 (PST)

(previous attempt had pdf attached - this one should work.)

> Tim, you had mentioned earlier wanting to be able to click on the
> names of elements in generated graphs of the source code and be
> taken to that point in the text.

Or, more precisely:

"i'd like to get diagrams autogenerated in the book. and i'd like
to be able to click on graph nodes entries and go right to the code

The autogeneration is going to be quite a trick, and the hyperlinking
in graphs isn't any cakewalk either, but I think I've demonstrated the
test imaginable - I cut and pasted an example from the XY-pic docs and
added it to a subset of the dhmatrix tex file - basically just enough
to let me try \usepackage{axiom}, \usepackage[all]{xy}, and
\usepackage[<fancystuff>]{hyperref} together.  Then I replaced the text
in one of the XY-pic objects with hyperref hyperlinking commands, and
added a target around a section header, and darned if it didn't work,
at at least with pdflatex!

Just for fun (and in case my machine wipes out) I'll attach the tex
document, but it's nothing to write home about.  (Does the list allow
attachments?) XY-pic is not for the faint of heart (it reminds me of
looking at some of the more mangled perl scripts I've seen, actually)
but it also looks very, very powerful, so I'll take a shot at it.  (I
don't even faintly understand the example in the attachment yet, which
is why its not a better example of what we would want.) The main
question looks to be automatic layout, and that could be a problem.  I
haven't been able to figure out what XY-pics abilities are in that
department, but I'm assuming it's not really designed for that.

Cheers,
CY

(Note:  interesting stuff is pretty much in the first part here - only
other point of interest is the code required to make Vectors section a
legal hyperlink target.  This is a first cut and maybe not even the
best way to set up the link but I was excited enough at seeing it work
that I wanted to let other people know it's possible.)

\documentclass{article}
\usepackage{axiom}
\usepackage[all]{xy}
\ifx\pdfoutput\undefined
\else
bookmarksopen=false, pdfnewwindow=true,
pdfstartview=FitH, pdfpagemode=UseOutlines]{hyperref}
\fi

\begin{document}
+<5em,-5em>@+,
(46,11)*+\hbox{Square}="s" *\frm{-,},
-<5em,-5em>@+,
"o";"s" **{} ?*+\hbox{Bend}="b"*\frm{.},
"o";"s"."b" **\crvs{-},
"o"."b";"s" **\crvs{-} ?>*\dir{>}
\endxy

\mathchardef\bigp="3250
\mathchardef\bigq="3251
\mathchardef\bigslash="232C
\section{Homogeneous Transformations}
The study of robot manipulation is concerned with the relationship
between
objects, and between objects and manipulators. In this chapter we will
develop the representation necessary to describe these relationships.
Similar
problems of representation have already been solved in the field of
computer
graphics, where the relationship between objects must also be
described.
Homogeneous transformations are used in this field and in computer
vision
[Duda] [Robserts63] [Roberts65]. These transformations were employed by

Denavit to describe linkages [Denavit] and are now used to describe
manipulators [Pieper] [Paul72] [Paul77b].

We will first establish notation for vectors and planes and then
introduce
transformations on them. These transformations consist primarily of
translation and rotation. We will then show that these transformations
can also be considered as coordinate frames in which to represent
objects, including the manipulator. The inverse transformation will
then be introduced. A later section describes the general rotation
transformation representing a rotation about a vector. An algorithm is
then described to find the equivalent axis and angle of rotations
represented by any given transformation. A brief section on stretching
and scaling transforms is included together with a section on the
perspective transformation. The chapter concludes with a section on
transformation equations.

\section{Notation}

In describing the relationship between objects we will make use of
point vectors, planes, and coordinate frames. Point vectors are
denoted by lower case, bold face characters. Planes are denoted by
script characters, and coordinate frames by upper case, bold face
characters. For example:

\begin{tabular}{ll}
vectors & {\bf v}, {\bf x1}, {\bf x} \\
planes  & $\bigp$, $\bigq$ \\
coordinate frames & {\bf I}, {\bf A}, {\bf CONV}\\
\end{tabular}\\

We will use point vectors, planes, and coordinate frames as variables
which have associated values. For example, a point vector has as value
its three Cartesian coordinate components.

If we wish to describe a point in space, which we will call {\sl p},
with respect to a coordinate frame {\bf E}, we will use a vector which
we will call {\bf v}. We will write this as

$$^E{\bf v}$$

\noindent
The leading superscript describes the defining coordinate frame.

We might also wish to describe this same point, {\sl p}, with respect
to a different coordinate frame, for example {\bf H}, using a vector
{\bf w} as

$$^H{\bf w}$$

\noindent
{\bf v} and {\bf w} are two vectors which probably have different
component values and ${\bf v} \ne {\bf w}$ even though both vectors
describe the same point {\sl p}. The case might also exist of a vector
{\bf a} describing a point 3 inches above any frame

$${^{F^1}}{\bf a}\qquad {^{F^2}}{\bf a}$$

\noindent
In this case the vectors are identical but describe different
points. Frequently, the defining frame will be obvious from the text
and the superscripts will be left off. In many cases the name of the
vector will be the same as the name of the object described, for
example, the tip of a pin might be described by a vector {\bf tip}
with respect to a frame {\bf BASE} as

$${^{BASE}}{\bf tip}$$

\noindent
If it were obvious from the text that we were describing the vector
with respect to {\bf BASE} then we might simply write

$${\bf tip}$$

If we also wish to describe this point with respect to another
coordinate frame say, {\bf HAND}, then we must use another vector to
describe this relationship, for example

$${^{HAND}{\bf tv}}$$

\noindent
${^{HAND}{\bf tv}}$ and {\bf tip} both describe the same feature but
have different values. In order to refer to individual components of
coordinate frames, point vectors, or planes, we add subscripts to
indicate the particular component. For example, the vector
${^{HAND}{\bf tv}}$ has components ${^{HAND}{\bf tv}}_{\bf x}$,
${^{HAND}{\bf tv}}_{\bf y}$, ${^{HAND}{\bf tv}}_{\bf z}$.

\hypertarget{Vectors}{\section{Vectors}}

The homogeneous coordinate representation of objects in $n$-space
is an $(n + 1)$-space entity such that a particular perspective
projection recreates the $n$-space. This can also be viewed as the
addition of an extra coordinate to each vector, a scale factor, such
that the vector has the same meaning if each component, including the
scale factor, is multiplied by a constant.

A point vector

$${\bf v} = a{\bf i} + b{\bf j} + c{\bf k}\eqno(1.1)$$

\noindent
where {\bf i}, {\bf j}, and {\bf k} are unit vectors along the $x$,
$y$, and $z$ coordinate axes, respectively, is represented in
homogeneous coordinates as a column matrix

$${\bf v} = \left[\matrix{{\bf x}\cr {\bf y}\cr {\bf z}\cr {\bf w}\cr} \right]\eqno(1.2)$$

\noindent
where

$${{\bf a} = {\bf x}/{\bf w}}$$
$${{\bf b} = {\bf y}/{\bf w}}\eqno(1.3)$$
$${{\bf c} = {\bf z}/{\bf w}}$$

\noindent
Thus the vector $3{\bf i} + 4{\bf j} + 5{\bf k}$ can be represented as
$[3,4,5,1]^{\rm T}$ or as $[6,8,10,2]^{\rm T}$ or again
as $[-30,-40,-50,-10]^{\rm T}$,
etc. The superscript $T$ indicates the transpose of the row vector
into a column vector. The vector at the origin, the null vector, is
represented as $[0,0,0,n]^{\rm T}$ where $n$ is any non-zero scale
factor. The vector $[0,0,0,0]^{\rm T}$ is undefined. Vectors of the
form
$[a,b,c,0]^{\rm T}$ represent vectors at infinity and are used to
represent
directions; the addition of any other finite vector does not change
their value in any way.

We will also make use of the vector dot and cross products. Given two
vectors

$${\bf a} = a_x{\bf i} + a_y{\bf j} + a_z{\bf k}\eqno(1.4)$$
$${\bf b} = b_x{\bf i} + b_y{\bf j} + b_z{\bf k}$$

\noindent
we define the vector dot product, indicated by $\cdot$'' as

$${\bf a} \cdot {\bf b} = {a_x}{b_x} + {a_y}{b_y} + {a_z}{b_z}\eqno(1.5)$$

\noindent
The dot product of two vectors is a scalar. The cross product,
indicated by an $\times$'', is another vector perpendicular to the
plane formed by the vectors of the product and is defined by

$${\bf a} \times {\bf b} = ({a_y}{b_z} - {a_z}{b_y}){\bf i} + ({a_z}{b_x} - {a_x}{b_z}){\bf j} + ({a_x}{b_y} - {a_y}{b_x}){\bf k}\eqno(1.6)$$

\noindent
This definition is easily remembered as the expansion of the
determinant

$${\bf a} \times {\bf b} = \left|\matrix{{\bf i}&{\bf j}&{\bf k}\cr {a_x}&{a_y}&{a_z}\cr {b_x}&{b_y}&{b_z}\cr}\right|\eqno(1.7)$$

\section{Planes}
A plane is represented as a row matrix

$$\bigp=[a,b,c,d]\eqno(1.8)$$

\noindent
such that if a point {\bf v} lies in a plane $\bigp$ the matrix
product

$$\bigp{\bf v} = 0\eqno(1.9)$$

\noindent
or in expanded form

$$xa + yb + zc + wd = 0\eqno(1.10)$$

\noindent
If we define a constant

$$m = +\sqrt{a^2 + b^2 + c^2}\eqno(1.11)$$

\noindent
and divide Equation 1.10 by $wm$ we obtain

$${x\over w}{a\over m} + {y\over w}{b\over m} + {z\over w}{c\over m} = -{d\over m}\eqno(1.12)$$

\noindent
The left hand side of Equation 1.12 is the vector dot product of two
vectors $(x/w){\bf i} + (y/w){\bf j} + (z/w){\bf k}$ and
$(a/m){\bf i} + (b/m){\bf j} + (c/m){\bf k}$ and represents the
directed distance of the point
$(x/w){\bf i} + (y/w){\bf j} + (z/w){\bf k}$ along the vector\\
$(a/m){\bf i} + (b/m){\bf j} + (c/m){\bf k}$. The vector
$(a/m){\bf i} + (b/m){\bf j} + (c/m){\bf k}$ can be interpreted as the
outward pointing normal of a plane situated a distance $-d/m$ from the
origin in the direction of the normal. Thus a plane $\bigp$ parallel
to the $x$,$y$ plane, one unit along the $z$ axis, is represented as

$${\rm {\ \ \ \ \ \ \ \ \ }} \bigp = [0,0,1,-1]\eqno(1.13)$$
$${\rm {or\ as\ \ \ }} \bigp = [0,0,2,-2]\eqno(1.14)$$
$${\rm {\ \ \ \ \ or\ as\ \ \ }} \bigp = [0,0,-100,100]\eqno(1.15)$$

\noindent
A point ${\bf v} = [10,20,1,1]$ should lie in this plane

$$[0,0,-100,100]\left[\matrix{10\cr 20\cr 1\cr 1\cr} \right] = 0\eqno(1.16)$$

\noindent
or

$$[0,0,1,-1]\left[\matrix{ -5\cr -10\cr -.5\cr -.5\cr} \right] = 0\eqno(1.17)$$

\noindent
The point ${\bf v} = [0,0,2,1]$ lies above the plane

$$[0,0,2,-2]\left[\matrix{0\cr 0\cr 2\cr 1\cr} \right] = 2\eqno(1.18)$$

and $\bigp{\bf v}$ is indeed positive, indicating that the point is
outside the plane in the direction of the outward pointing normal. A
point ${\bf v} = [0,0,0,1]$ lies below the plane

$$[0,0,1,-1]\left[\matrix{0\cr 0\cr 0\cr 1\cr} \right] = -1\eqno(1.19)$$

\noindent
The plane $[0,0,0,0]$ is undefined.

\end{document}

__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com