Vector calculations?

View: New views
2 Messages — Rating Filter:   Alert me  

Vector calculations?

by dwarnold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All,

Consider:

\documentclass[11pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{through}

\newcommand\ihat{\mathbf i}
\newcommand\jhat{\mathbf j}
\newcommand\khat{\mathbf k}

\renewcommand\vec[1]{\mathbf{#1}}
\newcommand{\norm}[1]{\lVert#1\rVert}

\begin{document}

\begin{center}
\begin{tikzpicture}
\def\A{$A(-3,1)$}
\def\B{$B(4,4)$}
\def\O{$O(0,0)$}
\draw [step=1,gray,very thin] (-5,-5) grid (5,5);
\draw[very thick,<->] (-5,0)--(5,0);
\draw[very thick,<->] (0,-5)--(0,5);
\coordinate [label=above left:\A] (A) at (-3,1);
\coordinate [label=above right:\B] (B) at (4,4);
\coordinate [label=below right:\O] (O) at (0,0);
\fill [black] (A) circle (2pt);
\fill [black] (B) circle (2pt);
\fill [black] (O) circle (2pt);
\draw[very thick,blue,->] (O)--(A);
\draw[very thick,blue,->] (O)--(B);
\draw[red] (A)--(B);
\end{tikzpicture}
\end{center}

\end{document}

I'd like to calculate the point that is on the line segment AB and is  
3 times further from A than it is from B. Then I'd like to put a  
little tick mark there perpendicular to the segment AB.

Suggestions?

David Arnold
College of the Redwoods
http://msemac.redwoods.edu/~darnold/index.php




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Vector calculations?

by Alain Matthes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Le 30 août 2009 à 08:39, David Arnold a écrit :

> further

Hi

Sorry my english is not very good and I don't know if
AM = 3 MB or if 3AM = MB . I take the first one.

Several possibilities but perhaps I miss a better one.

1) with \usetikzlibrary{decorations.markings}


    \begin{tikzpicture}[decoration={markings,
       mark=at position .25 with {\draw (0pt,-2pt) -- (0pt,2pt);}}]
    \def\A{$A(-3,1)$}
    \def\B{$B(4,4)$}
    \draw [step=1,gray,very thin] (-5,-5) grid (5,5);
    \coordinate [label=above left:\A] (A) at (-3,1);
    \coordinate [label=above right:\B] (B) at (4,4);
    \fill [black] (A) circle (2pt);
    \fill [black] (B) circle (2pt);

     \draw [help lines] grid (3,2);
      \draw [postaction={decorate}] (A) -- (B) ;
    \end{tikzpicture}


2) with  \usetikzlibrary{calc} and barycentric coordinates


\coordinate (n) at (barycentric cs:A=0.25,B=0.75 ,O=0);
\coordinate (nu) at ($ (n)!2pt!90:(B) $);
\coordinate (nd) at ($ (n)!2pt!-90:(B) $);
\draw[] (nd)--(nu);


3) with  \usetikzlibrary{calc} and $ ! ! $
\coordinate (m) at ($(A)!.75!(B)$);
\coordinate (mu) at ($ (m)!2pt!90:(B) $);
\coordinate (md) at ($ (m)!2pt!-90:(B) $);
\draw[] (md)--(mu);


remarks :

a) $ ! ! $ it's like barycentric in 2D

b) perhaps barycentric coordinates with 2D  would be a good thing

c) I'm not sure if with a dimension like 2pt, the calculations are  
accurate

Best Regards

Alain Matthes
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users