Numerical and symbolic geometry.

This file contains functions for analytic geometry in the plane. There are numerical Euler functions, and symbolic Maxima functions.

Load this file with "load geometry". See the example notebook for this package.

defaultd:=textheight()*1.5;

functionplotLabel(text:string, p:real vector, .. v:real vector=[1,1], d:number=defaultd)

Plot a label at position p Plot a label to a screen position with offset vector v (normalized, default is lower right) and distance d (in screen units)

functionplotPoint(p:real vector, name:string="default", ..

Plot a point [with a name] Plot a point at position x See:

plotLabel (Geometry in Euler)

functionplotSegment(A:real vector, B:real vector, .. name:string="default", d:number=defaultd)

Plot a segment from A to B d is the distance of the label

functionplotLine(g:real vector, name:string="default", .. d:number=defaultd)

Plot a line through A to B d is the distance of the label

functionturn(v:real vector, phi:number)

Turn a vector with angle phi

functionturnLeft(v:real vector)

Turn a vector orthogonally to the left

functionturnRight(v:real vector)

Turn a vector orthogonally to the right

functionlineThrough(A:real vector, B:real vector)

Compute a line through A and B returns [a,b,c] s.t. ax+by=c is an equation of the line.

functionlineWithDirection(A:real vector, v:real vector)

lineWithDirection(A,v) compute a line through A into direction v. See:

lineThrough (Geometry in Euler)

functiongetLineDirection(g:real vector)

Returns a direction vector of the line.

functiongetNormal(g:real vector)

Return a perpendicular vector on g

functiongetPointOnLine(g:real vector)

Return a point on the line.

functionperpendicular(A:real vector, g:real vector)

Compute a perpendicular line through A to g See:

lineThrough (Geometry in Euler),

parallel (Geometry in Euler)

functionparallel(A:real vector, g:real vector)

Compute a parallel line through A to g See:

perpendicular (Geometry in Euler)

functionlineIntersection(g:real vector, h:real vector)

Compute the intersection of two lines

functionprojectToLine(A:real vector, g:real vector)

Project a point to a line.

functionareaTriangle(A:real vector, B:real vector, C:real vector)

Compute the area of the triangle A,B,C

functioncomputeAngle(A:real vector, B:real vector, C:real vector)

Compute the angle at B.

functionsetPlotRange(a:number, b=none, c:number=0, d:number=0)

Set the plot range setPlotRange(r) sets the range to a rectangle around (0,0).

functioncircleWithCenter(A:real vector, r:number)

Return a circle around A with radius r.

functiongetCircleCenter(c:real vector)

Return the center of a circle.

functiongetCircleRadius(c:real vector)

Return the radius of a circle.

functionmiddlePerpendicular(A:real vector, B:real vector)

Return the middle perpendicular of AB.

functioncircleThrough(A,B,C)

Compute a circle through three points.

functionplotCircle(c,name="default",v=[1,-1],d=defaultd)

Plot a circle. The label will attach to the circle in direction v (default is lower right).

functionangleBisector(A:real vector, B:real vector, C:real vector)

Compute the middle perpendicular of the angle ABC

functiondistance(A:real vector, B:real vector)

Compute the distance of two points. See:

norm (Linear Algebra),

norm (Geometry in Euler)

functiondistanceSquared(A:real vector, B:real vector)

Compute the distance of two points, squared.

functionquadrance(A:real vector, B:real vector)

Compute the distance of two points, squared.

functionlineCircleIntersections(l:real vector, c:real vector)

Intersection a line with a circle. Return both intersection points, and the number of intersections.

functioncircleCircleIntersections(c1:real vector, c2:real vector)

Intersection of two circles. Return both intersection points, and the number of intersections.

functionnormalize(v:real vector)

Return the normalized vector v.

functioncrossProduct(v:real vector, w:real vector)

Compute the cross product of v and w.

functionplaneThrough(A:real vector, B:real vector, C:real vector)

Compute a plane through three points.

maximafunctionnorm(x)

The norm of a point x=[a,b]

maximafunctionnormalize(x)

The normalized vector x/norm(x)

maximafunctionscalp(a,b)

The scalar product a*b

maximafunctiondistance(A,B)

The distance of the points A and B

maximafunctiondistanceSquared(A,B)

The distance of the points A and B squared See:

quad (Geometry in Euler)

maximafunctionturnRight(v)

The vector v turned 90ï¿½ to the right

maximafunctionturnLeft(v)

The vector v turned 90ï¿½ to the left

maximafunctionlineThrough(A,B)

The line through A and B in the form [a,b,c] with equation ax+bx=c

maximafunctiongetLineEquation(line,x,y)

Equation of the line with variables x,y

maximafunctiongetHesseForm(line,x,y,A)

Hesseform of the line with the point A on the positive side.

maximafunctiongetLineDirection(line)

Direction vector of the line

maximafunctionperpendicular(A,line)

Perpendicular line through A.

maximafunctionparallel(line)

Parallel line through A.

maximafunctionlineIntersection(g,h)

Intersection point of the two lines.

maximafunctionprojectToLine(A,line)

Orthogonal projection of A to the line.

maximafunctionareaTriangle(A,B,C)

Area of the triangle.

maximafunctioncomputeAngle(A,B,C)

Angle with corner at A.

maximafunctioncircleWithCenter(A,r)

Circle around A with radius r.

maximafunctioncircleThrough(A,B,C)

Circle through three points.

maximafunctiongetCircleCenter(circle)

Center of the circle.

maximafunctiongetCircleRadius(circle)

Radius of the circle.

maximafunctionangleBisector(A,B,C)

Angle bisector for angle with corner at B.

maximafunctionquad(A,B)

Distance AB squared

maximafunctionspread(a,b,c)

Spread of the of the triangle a,b,c. The spread is sin(alpha)^2. alpha is opposite to a.

maximafunctioncrosslaw(a,b,c,sa)

Equation for three quads and one spread in a triangle. The spread is sa=sin(alpha)^2. alpha is opposite to a.

maximafunctiontriplespread(sa,sb,sc)

Equation for three spreads sa,sb,sc forming a triangle. The spreads are sin(phi)^2 for each angle.

maximafunctiondoublespread(sa)

Spread of the doubled angle. Spread of 2*phi, if sa=sin(phi)^2 is the spread of a.

The following definitions are sent to Maxima in direct mode when the file is loaded.