Parametrising the intersection of a sphere and plane with the aid of GeoGebra
Work done in collaboration with Bradley Welch
Part 1:
Context and problem formulation
Main Problem: Find the parametrisation of the intersection curve of a sphere and a plane.
Part 1: Context and problem formulation
Part 1: Context and problem formulation
Sphere of radius \(R>0,\) centred at \((x_0,y_0,z_0)\):
Plane defined by:
\(A,B\) and \(C\) real constants, not all simultaneaously zero.
Part 1: Context and problem formulation
Let \(\rho\) be the shortest signed distance between the centre of the sphere and the plane.
That is,
Part 1: Context and problem formulation
We can set the following cases for the intersection \(\Pi\cap S\):
1. If \(|\rho|<R,\) then \(\Pi\cap S\) is a circle.
2. If \(|\rho|=R,\) then \(\Pi\cap S\) is a point.
3. If \(|\rho|>R,\) then \(\Pi\cap S\) is a empty.
Part 1: Context and problem formulation
Part 1: Context and problem formulation
Find the parametrisation of the intersection curve of a sphere and a plane.
or
Conjecture: The solution provided by Geogebra takes the general vector form given as
The dynamic exploration in GeoGebra with different semiotic representations provides some clues to solve our main problem:
Part 1: Context and problem formulation
Conjecture: The solution provided by Geogebra takes the general vector form given as
Part 2: Learning trajectory
Part 2: Learning trajectory
Problem 1: Find the parametric equation of the curve obtained by intersecting the sphere \(S:x^2 +y^2 +z^2 =1\) and the plane \(\Pi:z= \dfrac{1}{2}.\)
Find the parametrisation of the intersection curve of a sphere and a plane.
Before solving the general problem:
Let's try to relax the conditions and solve the simplest case:
Part 2: Learning trajectory
Problem 1: Find the parametric equation of the curve obtained by intersecting the sphere \(S:x^2 +y^2 +z^2 =1\) and the plane \(\Pi:z= \dfrac{1}{2}.\)
Substitute \(z=\dfrac{1}{2}\) in the equation of the sphere:
\(x^2+y^2+\left(\dfrac{1}{2}\right)^2=1\)
Using the identity \(\;\cos^2(t)+\sin^2(t)=1\)
\(\Rightarrow\;\dfrac{4}{3}x^2+\dfrac{4}{3}y^2=1\)
Part 2: Learning trajectory
Part 2: Learning trajectory
Part 2: Learning trajectory
Problem 2: Compute the parametric equations of the curve obtained by intersecting the sphere and plane given by
\(S:x^2 +y^2 +z^2 =4\;\) and \(\;\Pi:2x+2y+z=-3,\)
respectively.
Rewrite the plane as \(\;z=-3-2x-2y\)
Then we obtain \(\;x^2+y^2+\left(-3-2-x-2y\right)^2=4\)
That is \(\;5x^2+8xy+5y^2+12x+12y+5=0\)
This is a conic section, also known as a quadratic form in \(\mathbb R^2,\) and can be written in matrix form as
\[\mathbf x^T M \mathbf x+ K \mathbf x+f=0\]
Now let's try a slightly more difficult problem!
Part 2: Learning trajectory
Problem 2: Compute the parametric equations of the curve obtained by intersecting the sphere and plane given by
\(S:x^2 +y^2 +z^2 =4\;\) and \(\;\Pi:2x+2y+z=-3,\)
respectively.
That is \(\;5x^2+8xy+5y^2+12x+12y+5=0\)
Let \(\mathbf{x}=\begin{pmatrix}x\\y\end{pmatrix}.\)
\(\mathbf x^T M \mathbf x+ K \mathbf x+f=0\)
Then we have
By means of a rotation of the plane about the origin, a translation of the plane, or both, it is possible to represent every conic in a simplified standard, or canonical, form.
Part 2: Learning trajectory
That is \(\;5x^2+8xy+5y^2+12x+12y+5=0\)
\(\mathbf x^T M \mathbf x+ K \mathbf x+f=0\)
By means of a rotation of the plane about the origin, a translation of the plane, or both, it is possible to represent every conic in a simplified standard, or canonical, form.
This process is known as diagonalisation of quadratic forms.
Let \(\mathbf{x}=\begin{pmatrix}x\\y\end{pmatrix}.\)
Then we have
Problem 2: Compute the parametric equations of the curve obtained by intersecting the sphere and plane given by
\(S:x^2 +y^2 +z^2 =4\;\) and \(\;\Pi:2x+2y+z=-3,\)
respectively.
Part 2: Learning trajectory
That is \(\;5x^2+8xy+5y^2+12x+12y+5=0\)
\(\mathbf x^T M \mathbf x+ K \mathbf x+f=0\)
Let \(\mathbf{x}=\begin{pmatrix}x\\y\end{pmatrix}.\)
Then we have
The diagonalisation process and a change of variables provides the following expression:
the simplified standard form of
Problem 2: Compute the parametric equations of the curve obtained by intersecting the sphere and plane given by
\(S:x^2 +y^2 +z^2 =4\;\) and \(\;\Pi:2x+2y+z=-3,\)
respectively.
Part 2: Learning trajectory
Using again the identity \(\cos^2(t)+\sin^2(t)=1\) and rewriting everything back with the variables \(x,y\) and \(z;\)
Problem 2: Compute the parametric equations of the curve obtained by intersecting the sphere and plane given by
\(S:x^2 +y^2 +z^2 =4\;\) and \(\;\Pi:2x+2y+z=-3,\)
respectively.
we obtain the solution:
Part 2: Learning trajectory
Part 2: Learning trajectory
Problem 3: Find the parametrisation of the intersection curve of the sphere and plane \[ \left\{ \begin{array} {rl} S: &(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2 \\ \\ \Pi: & Ax+By+Cz=D, \\ \end{array} \right. \] where \(A,B,C\) are not all simultaneously zero.
General problem!
To simplify some calculations, first we translate both objects to the origin: \[ \left\{ \begin{array} {rl} S_0: &x^2+y^2+z^2=R^2 \\ \\ \Pi_0: & A(x+x_0)+B(y+y_0)+C(z+z_0)=D \\ \end{array} \right. \]
Part 2: Learning trajectory
Problem 3: Find the parametrisation of the intersection curve of the sphere and plane \[ \left\{ \begin{array} {rl} S: &(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2 \\ \\ \Pi: & Ax+By+Cz=D, \\ \end{array} \right. \] where \(A,B,C\) are not all simultaneously zero.
Substituing the equation of the plane \(\Pi_0\) into the sphere \(S_0\) yields
\[ \left\{ \begin{array} {rl} S_0: &x^2+y^2+z^2=R^2 \\ \\ \Pi_0: & A(x+x_0)+B(y+y_0)+C(z+z_0)=D \\ \end{array} \right. \]
Part 2: Learning trajectory
Problem 3: Find the parametrisation of the intersection curve of the sphere and plane \[ \left\{ \begin{array} {rl} S: &(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2 \\ \\ \Pi: & Ax+By+Cz=D, \\ \end{array} \right. \] where \(A,B,C\) are not all simultaneously zero.
This expression is in fact a quadratic form:
\(ax^2+bxy+cy^2+dx+ey+f=0\)
So we can rewrite it as
\(\mathbf{x}^{T} M\mathbf{x}+K\mathbf{x}+f=0\)
Thus we can apply the process of diagonalisation
to obtain the solution of the general problem.
Part 2: Learning trajectory
Problem 3: Find the parametrisation of the intersection curve of the sphere and plane \[ \left\{ \begin{array} {rl} S: &(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2 \\ \\ \Pi: & Ax+By+Cz=D, \\ \end{array} \right. \] where \(A,B,C\) are not all simultaneously zero.
Thus we can apply the process of diagonalisation
to obtain the solution of the general problem.
Part 3: Final comments
Part 3: Final comments
Part 3: Final comments
\(\mathbf{x}^{T} M\mathbf{x}+K\mathbf{x}+f=0\)
Part 3: Final comments
Algebraic view
CAS view
3D view
Part 3: Final comments
Algebraic view
CAS view
3D view
Part 3: Final comments
/*
GeoGebra - Dynamic Mathematics for Everyone
http://www.geogebra.org
This file is part of GeoGebra.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation.
*/
/*
* AlgoJoinPointsSegment
*
* Created on 21. August 2003
*/
package org.geogebra.common.geogebra3D.kernel3D.algos;
import org.geogebra.common.geogebra3D.kernel3D.geos.GeoConic3D;
import org.geogebra.common.kernel.Construction;
import org.geogebra.common.kernel.StringTemplate;
import org.geogebra.common.kernel.commands.Commands;
import org.geogebra.common.kernel.geos.GeoElement;
import org.geogebra.common.kernel.kernelND.GeoCoordSys2D;
import org.geogebra.common.kernel.kernelND.GeoQuadricND;
import org.geogebra.common.kernel.matrix.CoordMatrix;
/**
*
* @author ggb3D
*
*/
public class AlgoIntersectPlaneQuadric extends AlgoElement3D {
// inputs
/** plane */
protected GeoCoordSys2D plane;
/** second coord sys */
protected GeoQuadricND quadric;
// output
/** intersection */
protected GeoConic3D conic;
private CoordMatrix cm = new CoordMatrix(3, 3);
private CoordMatrix tmpMatrix = new CoordMatrix(3, 4);
private CoordMatrix parametricMatrix;
/**
* Creates new AlgoIntersectLinePlane
*
* @param cons
* the construction
* @param plane
* plane
* @param quadric
* quadric
* @param addToCons
* whether to add to cons
*/
AlgoIntersectPlaneQuadric(Construction cons, GeoCoordSys2D plane,
GeoQuadricND quadric, boolean addToCons) {
super(cons, addToCons);
this.plane = plane;
this.quadric = quadric;
conic = newConic(cons);
// end
if (addToCons) {
end();
}
}
/**
* Creates new AlgoIntersectLinePlane
*
* @param cons
* the construction
* @param plane
* plane
* @param quadric
* quadric
*/
AlgoIntersectPlaneQuadric(Construction cons, GeoCoordSys2D plane,
GeoQuadricND quadric) {
this(cons, plane, quadric, true);
}
/**
* end of contructor for this algo
*/
protected void end() {
setInputOutput(new GeoElement[] { plane.toGeoElement(), quadric },
new GeoElement[] { conic });
}
/**
*
* @param cons1
* construction
* @return new conic for intersection
*/
protected GeoConic3D newConic(Construction cons1) {
return new GeoConic3D(cons1, true);
}
/**
* return the intersection
*
* @return the intersection
*/
public GeoConic3D getConic() {
return conic;
}
// /////////////////////////////////////////////
// COMPUTE
@Override
public void compute() {
conic.setCoordSys(plane.getCoordSys());
if (!quadric.isDefined() || !plane.isDefined()) {
conic.setUndefined();
return;
}
intersectPlaneQuadric(plane, quadric, conic);
}
private void intersectPlaneQuadric(GeoCoordSys2D inputPlane,
GeoQuadricND inputQuad, GeoConic3D outputConic) {
if (parametricMatrix == null) {
parametricMatrix = new CoordMatrix(4, 3);
}
CoordMatrix qm = inputQuad.getSymetricMatrix();
CoordMatrix pm = inputPlane.getCoordSys()
.getParametricMatrix(parametricMatrix);
// sets the conic matrix from plane and quadric matrix
cm.setMul(tmpMatrix.setMulT1(pm, qm), pm);
outputConic.setCoordSys(inputPlane.getCoordSys());
outputConic.setMatrix(cm);
}
@Override
public Commands getClassName() {
return Commands.IntersectPath;
}
@Override
final public String toString(StringTemplate tpl) {
StringBuilder sb = new StringBuilder();
sb.append(getLoc().getPlain("IntersectionCurveOfAB",
plane.getLabel(tpl), quadric.getLabel(tpl)));
return sb.toString();
}
}
We need to study the source code of GeoGebra, which is written in Java.
For example this: