STATUS: Draft
import numpy as np
import sympy as sp
from IPython.display import HTML, IFrame
import ipywidgets as widgets
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
mpl.rcParams['legend.fontsize'] = 10
import pandas as pd
import itertools
from IPython.display import Image
import math
# function to print latex
def renderListToLatex(e):
latex_rendering = []
for i in range(len(e)):
latex_rendering.append("$$" + sp.latex(e[i]) + "$$")
return(HTML("".join(latex_rendering[0:])))
Aim: To further explore the relationship between control points and related polynomials
Observe: Recall the dCB curve from the previous notebook, whose locus could be defined as the intesection of control points
Image("./Images/dCB1_1.PNG", width = 500)
Let $P0, P1 P2 \ldots$ is defined as an ongoing sequence of sequence of planar control points to arbitrary but finite length
P0, P1, P2, P3, Q0, Q1, Q2, Q3, R0, R1, R2, R3, S0, S1, S2, S3, t, p01, p02, p11, p12, p21, p22 = sp.symbols('P0, P1, P2, P3, Q0, Q1, Q2, Q3, R0, R1, R2, R3, S0, S1, S2, S3, t, p01, p02, p11, p12, p21, p22 ')
Observe: Recall the relationship between these points and lines between these points from dCB1
F1 = sp.Eq(Q0, (1 - t) * P0 + t * P1)
F2 = sp.Eq(Q1, (1 - t) * P1 + t * P2)
F3 = sp.Eq(Q2, (1 - t) * P2 + t * P3)
F4 = sp.Eq(R0, (1 - t) * Q0 + t * Q1)
F5 = sp.Eq(R1, (1 - t) * Q1 + t * Q2)
F6 = sp.Eq(R2, (1 - t) * Q2 + t * Q3)
F7 = sp.Eq(S0, (1 - t) * R0 + t * R1)
F8 = sp.Eq(S1, (1 - t) * R1 + t * R2)
F9 = sp.Eq(S2, (1 - t) * R2 + t * R3)
renderListToLatex([F1, F2, F3, F4, F5, F6, F7, F8, F9])
Observe: It is possible to view all of these expressions in terms of $P_0, P_1$ and $P_2$ using substitution.
Let $F10$ be a substution of $R_{0} = Q_{0} \left(1 - t\right) + Q_{1} t$ with $P0, P1$ and $P2$, grouped in terms of $t$
F10 = F4.subs(Q0, P0 * (1 -t) + P1 * t).subs(Q1, P1 * (1 - t) + P2 * t)
F11 = sp.Eq(R0, F10.rhs.factor(t))
F11
Observe: To further explore this, it is possible to introduce some addititional vectors, created from the points $P0, P1$ and $P2$.
Let $F12, F13$ and $F14$ be vectors created with the control points $P_0, P_1$, and $P_2$, and use $v_0, v_1$ and $a_1$ to express these vectors.
v0, v1, a1 = sp.symbols('v0, v1, a1')
F12 = sp.Eq(v0, P1 - P0)
F13 = sp.Eq(v1, P2 - P1)
F14 = sp.Eq(a1, P2 - 2 * P1 + P0)
renderListToLatex([F12, F13, F14])
Observe: As vectors, $v_0, v_1$ and $a_1$ can be be intuited as traversing a single vector path.
Observe: As a consequence of the relationships of $F12, F13$ and $F14$, it follows that:
$$a_1 = v1 - v_0$$and this implies that $a_1$ is defined as the subtraction between two vectors.
Observe: The choice of labels $v$ and $a$ is intended to provide an intuition of velocity and acceleration.
Let $F15$ be the equation $F11$, reflecting the substitutions of $v_0, v_1$ and $a_1$.
F15 = sp.Eq(R0, P0 + 2 * t * v1 + t**2 * a1)
F15
Let $F16$ be an alternative way of $F11$.
F16 = sp.Eq(R0, P0 + t * ( P2 - P0) + (t**2 - t) * (P0 - 2 * P1 + P2))
F16
Observe: it can be verified that $F16$ and $F11$ are equivalent to each other.
F16.expand() == F11.expand()
True
Observe $F16$ demonstrates that is possible to go from the point $P_0$ to the point $R_0$ on the dCB curve shown above by using a multiple of a vector $v_1$, as well as a multiple of $a1$
$\displaystyle R_{0} = P_{0} + t \left(- P_{0} + P_{2}\right) + \left(t^{2} - t\right) \left(P_{0} - 2 P_{1} + P_{2}\right)$
Observe: This suggests a new way of understanding how to move between points and rethink traditional notions of velocity and acceleration.
Observe: As a consequence of the relationships above, it also follows that $P2 - P0 \equiv v0 + v1$.
Observe: The above also shows that dCB curves have an algebraic foundation which goes hand in hand with thier affine construction.
Aim: Construct an Affine Plane using given assumptions
Method: Visualisation
Observe: dCB curves are created within the constraints of affine geometry.
Observe: Affine geometry makes the following assumptions:
Observe: There is no notion of perpendicularity, distance, length, angle, quadrance or spread, which means that there are no metrical notions allowed
Observe: The following steps can be undertaken to create lines on an affine plane:
Image("./Images/Lin1.png")
Observe: It is also possible to create subdivisions, using a similiar approach.
Image("./Images/AffineGridSubdivision.png", width=500)
Observe: It is also possible to create polygons or abitrary complexity in relation to points that have been created.
Image("./Images/Affine GridQuadrilateral.png", width=500)
Aim: Use affine constructions to develop a deeper understanding about dCB curves.
ObserveThe value of $t$ has been set between 0 and 1 in the algebraic representation of dCB curves. However it is possible to the value of $t$ which will lead to more points on parabola
Image("./Images/DCB3_1.PNG", width = 500)
Observe: There is a notion of direction for the above parabola, intuited as the direction through which the parabaola opens up. This is a vector, denoted as the Axis Direction for the parabola. Other attributes that are usually used to describe parabolas (such as focus, directrix, vertex) will not be used.
Observe: To obtain an axis direction through affine methods for this parabola (sketch below):
Observe: The point is the midpoint of the line from $P0$ to $P2$.
Observe: Recall the vector $a_1 = v_1 = v0$. In the context of below diagram, $a_1$ is vector from P1 to A. This is called the axis direction of the parabola.
Definition: The Axis Direction of a parabola, given by $a_1$ is the distinguised direction of the parabola vertex (Note there is no distinguished axis), which depends on the the control points.
Observe: The Axis Direction which can algebraically be described as $a_1$ is an important canonical oject with regard to curves within this space.
Image("./Images/DCB3_2.PNG", width = 500)
Aim: Construct a tangent for the dCB curve above without knowledge of $Q0$ and $Q1$
Observe: Finding a tangent to a given curve is a fundamental problem in calculus.
Observe: To obtain the tangent to the curve as a affine construction (skectch below):
Image("./Images/DCB_3_3.PNG", width = 500)
Aim: Demonstrate Achimedes' theorem of the area of an enclosed parabola.
Observe Area is intrinsically an affine notion in the context of the affine plane. It involves the idea of repeating a parallelogram, an idea which is powerful though rudimentary, showing that all area is relative to the affine plane.
Observe: This approach reformulates the idea of area as a way to subdivide and translate - cut and paste figures into another.
Observe: Consider the parallelogram below, $Q0,P1,Q1,D$ and note that, empirically, it has the same area as $P0, R0, P2$.
Image("./Images/DCB3_4.PNG", width = 500)
Observe: As $t$ gets closer to .5, the area of the triangle above is maximised, which is also the point at which $t$ is incident to the axis direction vector.
Observe: This is related to Archimedes famous result, which states that the parabolic area (enclosed by curve and $P0$ and $P2$ is equivalent to $\frac{4}{3}$ of the triangle area.
Image("./Images/DCB3_5.PNG", width = 500)
Observe There are different ways to move between control points on the on the dCB curve, (i.e. from $P0$ to $P1$) and these are related to the algebraic formulations presented above.
Todo Explore how different applications of the algebraic formulas lead to different traversals across the vectors.