SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

Points
Even a stopped clock is right once a day.
English proverb
< Linear | Convex | Math Clock >

Convex Combinations

Convex Parametrization between $A$ and $B$

  1. \[ \overrightarrow{OP}(t) = (1-t) \overrightarrow{OA} + t \overrightarrow{OB}, ~t \in \mathbb{R} \]
  2. ($(A)!0.25!(B)$);

TiKZ Listing: Fig.tikz.tex. PDF   PNG   SVG   ZIP*  
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc,math}

\tikzstyle{CS}=[-latex,thin]
\newcommand{\DrawOij}[1]
{
   \coordinate (O) at (0,0);
   \coordinate (i) at (#1,0);
   \coordinate (j) at (0,#1);
   
   \draw[CS]
      ($(O)!-1!(i)$) 
      -- 
      (i) node[right] {$x$};
      
   \draw[CS] 
      ($(O)!-1!(j)$)
      --
      (j)
      node[above] {$y$};
      
   \draw[left] (O) node {$O$};
}

\begin{document}
   \begin{tikzpicture}
       %Segment, nodes (A and B) and parametric points
       \tikzstyle{S}=[very thick]
       \tikzstyle{N}=[anchor=east]%same as left
       \tikzstyle{P}=[anchor=north west]
       
       %Draw coordinate system
       \DrawOij{7};
       
       
       %Define coordinates
       \coordinate (A) at ( 1+0.5,2);
       \coordinate (B) at (-1+0.5,-2);
       
       %%draw segment
       \draw[S] (A) -- (B);
       
       %Draw nodes and titles
       \filldraw[N] (A) circle(2pt) node {$A$};
       \filldraw[N] (B) circle(2pt) node {$B$};
        
       
       %Draw sequence of points 'on the line'...
       %Start and end \t's
       \tikzmath{\tstart=-1;};
       \tikzmath{\tend=2;};
       
       %Number of points
       \tikzmath{\N=6;};
       
       %Step size
       \tikzmath{\dt=(\tend-\tstart)/\N;};
       %Second \t
       \tikzmath{\tnext=\tstart+\dt;};

       
       \foreach \t in {\tstart,\tnext,...,\tend}
       {
          %CONVEX COMBINATION
          \coordinate (P) at ($(A)!\t!(B)$);
          \filldraw (P) circle(1pt);
          \node[P] at (P) {$t=\t$};
       }
       
       \draw[dotted] ($(A)!\tstart-\dt!(B)$) -- ($(A)!\tend+\dt!(B)$);
   \end{tikzpicture}
\end{document}
< Linear | Convex | Math Clock >
Messages:
0 secs.