# JSXGraph Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

## Elements

## Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Button
- Cardinalspline
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Conic
- Curve
- Derivative
- Ellipse
- Functiongraph
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Dump
- JXG.EventEmitter
- JXG.GeometryElement
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Line
- JXG.Math
- JXG.Math.Geometry
- JXG.Math.Numerics
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Point
- JXG.Polygon
- JXG.Server
- JXG.Server.modules
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.VMLRenderer
- JXG.XML
- Label
- Line
- Locus
- MajorArc
- MajorSector
- Midpoint
- MinorArc
- MinorSector
- Mirrorelement
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelpoint
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- PolarLine
- PolePoint
- Polygon
- Quadtree
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopetriangle
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle

# Namespace JXG.Math.Geometry

↳ JXG.Math.Geometry

Defined in: geometry.js.

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.Math.Geometry Math.Geometry namespace definition

Method Summary
Method Attributes | Method Name and Description
--- | ---
<private> <static> | JXG.Math.Geometry._bezierBbox(curve) Computes the bounding box [minX, maxY, maxX, minY] of a Bezier curve segment from its control points.
<private> <static> | JXG.Math.Geometry._bezierLineMeetSubdivision(testSegment, blue, level, testSegment)
<private> <static> | JXG.Math.Geometry._bezierListConcat(L, Lnew, t1, t2) Append list of intersection points to a list.
<private> <static> | JXG.Math.Geometry._bezierMeetSubdivision(red, blue, level) Find intersections of two Bezier curve segments by recursive subdivision.
<private> <static> | JXG.Math.Geometry._bezierOverlap(bb1, bb2) Decide if two Bezier curve segments overlap by comparing their bounding boxes.
<private> <static> | JXG.Math.Geometry._bezierSplit(curve) Splits a Bezier curve segment defined by four points into two Bezier curve segments.
<static> | JXG.Math.Geometry.affineDistance(array1, array2, n) Calculates euclidean distance for two given arrays of the same length.
<static> <deprecated> | JXG.Math.Geometry.angle(A, B, C) Calculates the angle defined by the points A, B, C.
<static> | JXG.Math.Geometry.angleBisector(A, B, C, board) Calculates a point on the bisection line between the three points A, B, C.
<static> | JXG.Math.Geometry.bezierArc(A, B, C, withLegs, sgn) Generate the defining points of a 3rd degree bezier curve that approximates a circle sector defined by three arrays A, B,C, each of length three.
<static> | JXG.Math.Geometry.calcLabelQuadrant(angle) Calculates the visProp.position corresponding to a given angle.
<static> | JXG.Math.Geometry.calcLineDelimitingPoints(el, point1, point2) A line can be a segment, a straight, or a ray.
<static> | JXG.Math.Geometry.calcStraight(el, point1, point2, margin) A line can be a segment, a straight, or a ray.
<static> | JXG.Math.Geometry.circumcenter(point1, point2, point3, board) Calculates the center of the circumcircle of the three given points.
<static> <deprecated> | JXG.Math.Geometry.circumcenterMidpoint()
<static> | JXG.Math.Geometry.distance(array1, array2, n) Calculates the euclidean norm for two given arrays of the same length.
<static> | JXG.Math.Geometry.distPointLine(point, line) Calculates the distance of a point to a line.
<static> | JXG.Math.Geometry.GrahamScan(points) Calculate the complex hull of a point cloud.
<static> | JXG.Math.Geometry.intersectionFunction(board, el1,el2,i, i, j, alwaysintersect) Generate the function which computes the coordinates of the intersection point.
<static> | JXG.Math.Geometry.isSameDir(p1, p2, i1, i2) The vectors `p2-p1` and `i2-i1` are supposed to be collinear.
<static> | JXG.Math.Geometry.isSameDirection(start, p, s) If you're looking from point "start" towards point "s" and can see the point "p", true is returned.
<static> | JXG.Math.Geometry.meet(el1, el2, i, board) Computes the intersection of a pair of lines, circles or both.
<static> | JXG.Math.Geometry.meetBezierCurveRedBlueSegments(red, blue, nr) Find the nr-th intersection point of two Bezier curves, i.e.
<static> | JXG.Math.Geometry.meetBeziersegmentBeziersegment(red, blue, testSegment) Find the nr-th intersection point of two Bezier curve segments.
<static> | JXG.Math.Geometry.meetCircleCircle(circ1, circ2, i, board) Intersection of two circles.
<static> | JXG.Math.Geometry.meetCurveCurve(c1, c2, nr, t2ini, board, method) Compute an intersection of the curves c1 and c2.
<static> | JXG.Math.Geometry.meetCurveLine(el1, el2, nr, board, alwaysIntersect) Intersection of curve with line, Order of input does not matter for el1 and el2.
<static> | JXG.Math.Geometry.meetCurveLineContinuous(cu, li, nr, board, testSegment) Intersection of line and curve, continuous case.
<private> <static> | JXG.Math.Geometry.meetCurveLineContinuousOld(cu, li, nr, board) Intersection of line and curve, continuous case.
<static> | JXG.Math.Geometry.meetCurveLineDiscrete(cu, li, nr, board, testSegment) Intersection of line and curve, discrete case.
<static> | JXG.Math.Geometry.meetCurveRedBlueSegments(red, blue, nr) Find the n-th intersection point of two curves named red (first parameter) and blue (second parameter).
<static> | JXG.Math.Geometry.meetLineBoard(line, board, margin) Intersection of the line with the board
<static> | JXG.Math.Geometry.meetLineCircle(lin, circ, i, board) Intersection of line and circle.
<static> | JXG.Math.Geometry.meetLineLine(l1, l2, i, board) Intersection of two lines.
<static> | JXG.Math.Geometry.meetSegmentSegment(p1, p2, q1, q2) Intersection of two segments.
<static> | JXG.Math.Geometry.perpendicular(line, point, board) Calculates the coordinates of a point on the perpendicular to the given line through the given point.
<static> | JXG.Math.Geometry.projectCoordsToBeziersegment(pos, curve, start) Finds the coordinates of the closest point on a Bezier segment of a JXG.Curve to a given coordinate array.
<static> | JXG.Math.Geometry.projectCoordsToCurve(x, y, t, curve, board) Calculates the coordinates of the projection of a coordinates pair on a given curve.
<static> | JXG.Math.Geometry.projectCoordsToPolygon(p, pol) Calculates the coordinates of the closest orthogonal projection of a given coordinate array onto the border of a polygon.
<static> | JXG.Math.Geometry.projectCoordsToSegment(p, q1, q2) Calculates the coordinates of the orthogonal projection of a given coordinate array on a given line segment defined by two coordinate arrays.
<static> | JXG.Math.Geometry.projectPointToBoard(point, board)
<static> | JXG.Math.Geometry.projectPointToCircle(point, circle, board) Calculates the coordinates of the projection of a given point on a given circle.
<static> | JXG.Math.Geometry.projectPointToCurve(point, curve, board) Calculates the coordinates of the projection of a given point on a given curve.
<static> | JXG.Math.Geometry.projectPointToLine(point, line, board) Calculates the coordinates of the orthogonal projection of a given point on a given line.
<static> | JXG.Math.Geometry.projectPointToPoint(point, dest) Trivial projection of a point to another point.
<static> | JXG.Math.Geometry.projectPointToTurtle(point, turtle, board) Calculates the coordinates of the projection of a given point on a given turtle.
<static> | JXG.Math.Geometry.rad(A, B, C) Calculates the internal angle defined by the three points A, B, C if you're going from A to C around B counterclockwise.
<static> | JXG.Math.Geometry.reflection(line, point, board) Reflects the point along the line.
<static> | JXG.Math.Geometry.reuleauxPolygon(points, nr) Helper function to create curve which displays a Reuleaux polygons.
<static> | JXG.Math.Geometry.rotation(rotpoint, point, phi, board) Computes the new position of a point which is rotated around a second point (called rotpoint) by the angle phi.
<static> | JXG.Math.Geometry.signedPolygon(p, sort) Determine the signed area of a non-intersecting polygon.
<static> | JXG.Math.Geometry.signedTriangle(p1, p2, p3) Signed triangle area of the three points given.
<static> | JXG.Math.Geometry.sortVertices(p) Sort vertices counter clockwise starting with the point with the lowest y coordinate.
<static> | JXG.Math.Geometry.trueAngle(A, B, C) Calculates the angle defined by the three points A, B, C if you're going from A to C around B counterclockwise.

Namespace Detail
JXG.Math.Geometry
Math.Geometry namespace definition
Method Detail
<private> <static> {Array} JXG.Math.Geometry._bezierBbox(curve)
Computes the bounding box [minX, maxY, maxX, minY] of a Bezier curve segment from its control points.

Parameters:
{Array} curve
  Array of four coordinate arrays of length 2 defining a Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].

Returns:
  {Array} Bounding box [minX, maxY, maxX, minY]

<private> <static> JXG.Math.Geometry._bezierLineMeetSubdivision(testSegment, blue, level, testSegment)

Parameters:
{Boolean} testSegment
  Test if intersection has to be inside of the segment or somewhere on the line defined by the segment
blue
level
testSegment

<private> <static> JXG.Math.Geometry._bezierListConcat(L, Lnew, t1, t2)
Append list of intersection points to a list.

Parameters:
L
Lnew
t1
t2

<private> <static> {Array} JXG.Math.Geometry._bezierMeetSubdivision(red, blue, level)
Find intersections of two Bezier curve segments by recursive subdivision. Below maxlevel determine intersections by intersection line segments.

Parameters:
{Array} red
  Array of four coordinate arrays of length 2 defining the first Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].
{Array} blue
  Array of four coordinate arrays of length 2 defining the second Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].
{Number} level
  Recursion level

Returns:
  {Array} List of intersection points (up to nine). Each intersection point is an array of length three (homogeneous coordinates) plus preimages.

<private> <static> {Boolean} JXG.Math.Geometry._bezierOverlap(bb1, bb2)
Decide if two Bezier curve segments overlap by comparing their bounding boxes.

Parameters:
{Array} bb1
  Bounding box of the first Bezier curve segment
{Array} bb2
  Bounding box of the second Bezier curve segment

Returns:
  {Boolean} true if the bounding boxes overlap, false otherwise.

<private> <static> {Array} JXG.Math.Geometry._bezierSplit(curve)
Splits a Bezier curve segment defined by four points into two Bezier curve segments. Dissection point is t=1/2.

Parameters:
{Array} curve
  Array of four coordinate arrays of length 2 defining a Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].

Returns:
  {Array} Array consisting of two coordinate arrays for Bezier curves.

<static> {Number} JXG.Math.Geometry.affineDistance(array1, array2, n)
Calculates euclidean distance for two given arrays of the same length. If one of the arrays contains a zero in the first coordinate, and the euclidean distance is different from zero it is a point at infinity and we return Infinity.

Parameters:
{Array} array1
  Array containing elements of type number.
{Array} array2
  Array containing elements of type number.
{Number} n Optional
  Length of the arrays. Default is the minimum length of the given arrays.

Returns:
  {Number} Euclidean (affine) distance of the given vectors.

<static> {Number} JXG.Math.Geometry.angle(A, B, C)
Calculates the angle defined by the points A, B, C.

Parameters:
{JXG.Point|Array} A
  A point or [x,y] array.
{JXG.Point|Array} B
  Another point or [x,y] array.
{JXG.Point|Array} C
  A circle - no, of course the third point or [x,y] array.

Deprecated:
Use JXG.Math.Geometry.rad instead.

Returns:
  {Number} The angle in radian measure.

See:
  #rad
  #trueAngle

<static> {JXG.Coords} JXG.Math.Geometry.angleBisector(A, B, C, board)
Calculates a point on the bisection line between the three points A, B, C. As a result, the bisection line is defined by two points: Parameter B and the point with the coordinates calculated in this function. Does not work for ideal points.

Parameters:
{JXG.Point} A
  Point
{JXG.Point} B
  Point
{JXG.Point} C
  Point
board Optional, Default: A.board
  Reference to the board

Returns:
  {JXG.Coords} Coordinates of the second point defining the bisection.

<static> JXG.Math.Geometry.bezierArc(A, B, C, withLegs, sgn)
Generate the defining points of a 3rd degree bezier curve that approximates a circle sector defined by three arrays A, B,C, each of length three. The coordinate arrays are given in homogeneous coordinates.

Parameters:
{Array} A
  First point
{Array} B
  Second point (intersection point)
{Array} C
  Third point
{Boolean} withLegs
  Flag. If true the legs to the intersection point are part of the curve.
{Number} sgn
  Wither 1 or -1. Needed for minor and major arcs. In case of doubt, use 1.

<static> JXG.Math.Geometry.calcLabelQuadrant(angle)
Calculates the visProp.position corresponding to a given angle.

Parameters:
{number} angle
  angle in radians. Must be in range (-2pi,2pi).

<static> JXG.Math.Geometry.calcLineDelimitingPoints(el, point1, point2)
A line can be a segment, a straight, or a ray. so it is not always delimited by point1 and point2. This method adjusts the line's delimiting points taking into account its nature, the viewport defined by the board. A segment is delimited by start and end point, a straight line or ray is delimited until it meets the boards boundaries. However, if the line has infinite ticks, it will be delimited by the projection of the boards vertices onto itself.

Parameters:
{JXG.Line} el
  Reference to a line object, that needs calculation of start and end point.
{JXG.Coords} point1
  Coordinates of the point where line drawing begins. This value is calculated and set by this method.
{JXG.Coords} point2
  Coordinates of the point where line drawing ends. This value is calculated and set by this method.

See:
  Line
  JXG.Line

<static> JXG.Math.Geometry.calcStraight(el, point1, point2, margin)
A line can be a segment, a straight, or a ray. so it is not always delimited by point1 and point2 calcStraight determines the visual start point and end point of the line. A segment is only drawn from start to end point, a straight line is drawn until it meets the boards boundaries.

Parameters:
{JXG.Line} el
  Reference to a line object, that needs calculation of start and end point.
{JXG.Coords} point1
  Coordinates of the point where line drawing begins. This value is calculated and set by this method.
{JXG.Coords} point2
  Coordinates of the point where line drawing ends. This value is calculated and set by this method.
{Number} margin
  Optional margin, to avoid the display of the small sides of lines.

Returns:
  null

See:
  Line
  JXG.Line

<static> {JXG.Coords} JXG.Math.Geometry.circumcenter(point1, point2, point3, board)
Calculates the center of the circumcircle of the three given points.

Parameters:
{JXG.Point} point1
  Point
{JXG.Point} point2
  Point
{JXG.Point} point3
  Point
{JXG.Board} board Optional, Default: point1.board
  Reference to the board

Returns:
  {JXG.Coords} Coordinates of the center of the circumcircle of the given points.

<static> JXG.Math.Geometry.circumcenterMidpoint()

Deprecated:
Please use JXG.Math.Geometry.circumcenter instead.

<static> {Number} JXG.Math.Geometry.distance(array1, array2, n)
Calculates the euclidean norm for two given arrays of the same length.

Parameters:
{Array} array1
  Array of Number
{Array} array2
  Array of Number
{Number} n Optional
  Length of the arrays. Default is the minimum length of the given arrays.

Returns:
  {Number} Euclidean distance of the given vectors.

<static> {Number} JXG.Math.Geometry.distPointLine(point, line)
Calculates the distance of a point to a line. The point and the line are given by homogeneous coordinates. For lines this can be line.stdform.

Parameters:
{Array} point
  Homogeneous coordinates of a point.
{Array} line
  Homogeneous coordinates of a line ([C,A,B] where A*x+B*y+C*z=0).

Returns:
  {Number} Distance of the point to the line.

<static> {Array} JXG.Math.Geometry.GrahamScan(points)
Calculate the complex hull of a point cloud.

Parameters:
{Array} points
  An array containing JXG.Point, JXG.Coords, and/or arrays.

Returns:
  {Array}

<static> {Function} JXG.Math.Geometry.intersectionFunction(board, el1,el2,i, i, j, alwaysintersect)
Generate the function which computes the coordinates of the intersection point. Primarily used in JXG.Point#createIntersectionPoint.

Parameters:
{JXG.Board} board
  object
{JXG.Line|JXG.Circle_JXG.Line|JXG.Circle_Number} el1,el2,i
  The result will be a intersection point on el1 and el2. i determines the intersection point if two points are available:
  - i==0: use the positive square root,
  - i==1: use the negative square root.
  See further JXG.Point#createIntersectionPoint.
{Boolean} alwaysintersect.
  Flag that determines if segements and arc can have an outer intersection point on their defining line or circle.
i
j
alwaysintersect

Returns:
  {Function} Function returning a JXG.Coords object that determines the intersection point.

<static> {Boolean} JXG.Math.Geometry.isSameDir(p1, p2, i1, i2)
The vectors `p2-p1` and `i2-i1` are supposed to be collinear. If their cosine is positive they point into the same direction otherwise they point in opposite direction.

Parameters:
{JXG.Coords} p1
{JXG.Coords} p2
{JXG.Coords} i1
{JXG.Coords} i2

Returns:
  {Boolean} True, if `p2-p1` and `i2-i1` point into the same direction

<static> {Boolean} JXG.Math.Geometry.isSameDirection(start, p, s)
If you're looking from point "start" towards point "s" and can see the point "p", true is returned. Otherwise false.

Parameters:
{JXG.Coords} start
  The point you're standing on.
{JXG.Coords} p
  The point in which direction you're looking.
{JXG.Coords} s
  The point that should be visible.

Returns:
  {Boolean} True, if from start the point p is in the same direction as s is, that means s-start = k*(p-start) with k>=0.

<static> {JXG.Coords} JXG.Math.Geometry.meet(el1, el2, i, board)
Computes the intersection of a pair of lines, circles or both. It uses the internal data array stdform of these elements.

Parameters:
{Array} el1
  stdform of the first element (line or circle)
{Array} el2
  stdform of the second element (line or circle)
{Number} i
  Index of the intersection point that should be returned.
board
  Reference to the board.

Returns:
  {JXG.Coords} Coordinates of one of the possible two or more intersection points. Which point will be returned is determined by i.

<static> {Array} JXG.Math.Geometry.meetBezierCurveRedBlueSegments(red, blue, nr)
Find the nr-th intersection point of two Bezier curves, i.e. curves with bezierDegree == 3.

Parameters:
{JXG.Curve} red
  Curve with bezierDegree == 3
{JXG.Curve} blue
  Curve with bezierDegree == 3
{Number} nr
  The number of the intersection point which should be returned.

Returns:
  {Array} The homogeneous coordinates of the nr-th intersection point.

<static> {Array} JXG.Math.Geometry.meetBeziersegmentBeziersegment(red, blue, testSegment)
Find the nr-th intersection point of two Bezier curve segments.

Parameters:
{Array} red
  Array of four coordinate arrays of length 2 defining the first Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].
{Array} blue
  Array of four coordinate arrays of length 2 defining the second Bezier curve segment, i.e. [[x0,y0], [x1,y1], [x2,y2], [x3,y3]].
{Boolean} testSegment
  Test if intersection has to be inside of the segment or somewhere on the line defined by the segment

Returns:
  {Array} Array containing the list of all intersection points as homogeneous coordinate arrays plus preimages [x,y], t_1, t_2] of the two Bezier curve segments.

<static> {JXG.Coords} JXG.Math.Geometry.meetCircleCircle(circ1, circ2, i, board)
Intersection of two circles.

Parameters:
{Array} circ1
  stdform of the first circle
{Array} circ2
  stdform of the second circle
{number} i
  number of the returned intersection point. i==0: use the positive square root, i==1: use the negative square root.
{JXG.Board} board
  Reference to the board.

Returns:
  {JXG.Coords} Coordinates of the intersection point

<static> {JXG.Coords} JXG.Math.Geometry.meetCurveCurve(c1, c2, nr, t2ini, board, method)
Compute an intersection of the curves c1 and c2. We want to find values t1, t2 such that c1(t1) = c2(t2), i.e. (c1_x(t1)-c2_x(t2),c1_y(t1)-c2_y(t2)) = (0,0). Methods: segment-wise intersections (default) or generalized Newton method.

Parameters:
{JXG.Curve} c1
  Curve, Line or Circle
{JXG.Curve} c2
  Curve, Line or Circle
{Number} nr
  the nr-th intersection point will be returned.
{Number} t2ini
  not longer used.
{JXG.Board} board Optional, Default: c1.board
  Reference to a board object.
{String} method Optional, Default: 'segment'
  Intersection method, possible values are 'newton' and 'segment'.

Returns:
  {JXG.Coords} intersection point

<static> {JXG.Coords} JXG.Math.Geometry.meetCurveLine(el1, el2, nr, board, alwaysIntersect)
Intersection of curve with line, Order of input does not matter for el1 and el2. From version 0.99.7 on this method calls JXG.Math.Geometry.meetCurveLineDiscrete. If higher precision is needed, JXG.Math.Geometry.meetCurveLineContinuous has to be used.

Parameters:
{JXG.Curve|JXG.Line} el1
  Curve or Line
{JXG.Curve|JXG.Line} el2
  Curve or Line
{Number} nr
  the nr-th intersection point will be returned.
{JXG.Board} board Optional, Default: el1.board
  Reference to a board object.
{Boolean} alwaysIntersect
  If false just the segment between the two defining points are tested for intersection

Returns:
  {JXG.Coords} Intersection point. In case no intersection point is detected, the ideal point [0,1,0] is returned.

<static> JXG.Math.Geometry.meetCurveLineContinuous(cu, li, nr, board, testSegment)
Intersection of line and curve, continuous case. Finds the nr-the intersection point Uses JXG.Math.Geometry.meetCurveLineDiscrete as a first approximation. A more exact solution is then found with JXG.Math.Numerics.root.

Parameters:
{JXG.Curve} cu
  Curve
{JXG.Line} li
  Line
{Number} nr
  Will return the nr-th intersection point.
{JXG.Board} board
testSegment

<private> <static> JXG.Math.Geometry.meetCurveLineContinuousOld(cu, li, nr, board)
Intersection of line and curve, continuous case. Segments are treated as lines. Finding the nr-the intersection point works for nr=0,1 only.

Parameters:
{JXG.Curve} cu
  Curve
{JXG.Line} li
  Line
{Number} nr
  Will return the nr-th intersection point.
{JXG.Board} board
  BUG: does not respect cu.minX() and cu.maxX()

<static> {JXG.Coords} JXG.Math.Geometry.meetCurveLineDiscrete(cu, li, nr, board, testSegment)
Intersection of line and curve, discrete case. Segments are treated as lines. Finding the nr-th intersection point should work for all nr.

Parameters:
{JXG.Curve} cu
{JXG.Line} li
{Number} nr
{JXG.Board} board
{Boolean} testSegment
  Test if intersection has to be inside of the segment or somewhere on the line defined by the segment

Returns:
  {JXG.Coords} Intersection point. In case no intersection point is detected, the ideal point [0,1,0] is returned.

<static> JXG.Math.Geometry.meetCurveRedBlueSegments(red, blue, nr)
Find the n-th intersection point of two curves named red (first parameter) and blue (second parameter). We go through each segment of the red curve and search if there is an intersection with a segemnt of the blue curve. This double loop, i.e. the outer loop runs along the red curve and the inner loop runs along the blue curve, defines the n-th intersection point. The segments are either line segments or Bezier curves of degree 3. This depends on the property bezierDegree of the curves.

This method works also for transformed curves, since only the already transformed points are used.

Parameters:
{JXG.Curve} red
{JXG.Curve} blue
{Number} nr

<static> {Array} JXG.Math.Geometry.meetLineBoard(line, board, margin)
Intersection of the line with the board

Parameters:
{Array} line
  stdform of the line in screen coordinates
{JXG.Board} board
  reference to a board.
{Number} margin
  optional margin, to avoid the display of the small sides of lines.

Returns:
  {Array} [intersection coords 1, intersection coords 2]

<static> {JXG.Coords} JXG.Math.Geometry.meetLineCircle(lin, circ, i, board)
Intersection of line and circle.

Parameters:
{Array} lin
  stdform of the line
{Array} circ
  stdform of the circle
{number} i
  number of the returned intersection point. i==0: use the positive square root, i==1: use the negative square root.
{JXG.Board} board
  Reference to a board.

Returns:
  {JXG.Coords} Coordinates of the intersection point

<static> {JXG.Coords} JXG.Math.Geometry.meetLineLine(l1, l2, i, board)
Intersection of two lines.

Parameters:
{Array} l1
  stdform of the first line
{Array} l2
  stdform of the second line
{number} i
  unused
{JXG.Board} board
  Reference to the board.

Returns:
  {JXG.Coords} Coordinates of the intersection point.

<static> {Array} JXG.Math.Geometry.meetSegmentSegment(p1, p2, q1, q2)
Intersection of two segments.

Parameters:
{Array} p1
  First point of segment 1 using homogeneous coordinates [z,x,y]
{Array} p2
  Second point of segment 1 using homogeneous coordinates [z,x,y]
{Array} q1
  First point of segment 2 using homogeneous coordinates [z,x,y]
{Array} q2
  Second point of segment 2 using homogeneous coordinates [z,x,y]

Returns:
  {Array} [Intersection point, t, u] The first entry contains the homogeneous coordinates of the intersection point. The second and third entry gives the position of the intersection between the two defining points. For example, the second entry t is defined by: intersection point = t*p1 + (1-t)*p2.

<static> {Array} JXG.Math.Geometry.perpendicular(line, point, board)
Calculates the coordinates of a point on the perpendicular to the given line through the given point.

Parameters:
{JXG.Line} line
  A line.
{JXG.Point} point
  Point which is projected to the line.
{JXG.Board} board Optional, Default: point.board
  Reference to the board

Returns:
  {Array} Array of length two containing coordinates of a point on the perpendicular to the given line through the given point and boolean flag "change".

<static> {Array} JXG.Math.Geometry.projectCoordsToBeziersegment(pos, curve, start)
Finds the coordinates of the closest point on a Bezier segment of a JXG.Curve to a given coordinate array.

Parameters:
{Array} pos
  Point to project in homogeneous coordinates.
{JXG.Curve} curve
  Curve of type "plot" having Bezier degree 3.
{Number} start
  Number of the Bezier segment of the curve.

Returns:
  {Array} The coordinates of the projection of the given point on the given Bezier segment and the preimage of the curve which determines the closest point.

<static> {JXG.Coords} JXG.Math.Geometry.projectCoordsToCurve(x, y, t, curve, board)
Calculates the coordinates of the projection of a coordinates pair on a given curve. In case of function graphs this is the intersection point of the curve and the parallel to y-axis through the given point.

Parameters:
{Number} x
  coordinate to project.
{Number} y
  coordinate to project.
{Number} t
  start value for newtons method
{JXG.Curve} curve
  Curve on that the point is projected.
{JXG.Board} board Optional, Default: curve.board
  Reference to a board.

Returns:
  {JXG.Coords} Array containing the coordinates of the projection of the given point on the given graph and the position on the curve.

See:
  #projectPointToCurve

<static> {Array} JXG.Math.Geometry.projectCoordsToPolygon(p, pol)
Calculates the coordinates of the closest orthogonal projection of a given coordinate array onto the border of a polygon.

Parameters:
{Array} p
  Point to project.
{JXG.Polygon} pol
  Polygon element

Returns:
  {Array} The coordinates of the closest projection of the given point to the border of the polygon.

<static> {Array} JXG.Math.Geometry.projectCoordsToSegment(p, q1, q2)
Calculates the coordinates of the orthogonal projection of a given coordinate array on a given line segment defined by two coordinate arrays.

Parameters:
{Array} p
  Point to project.
{Array} q1
  Start point of the line segment on that the point is projected.
{Array} q2
  End point of the line segment on that the point is projected.

Returns:
  {Array} The coordinates of the projection of the given point on the given segment and the factor that determines the projected point as a convex combination of the two endpoints q1 and q2 of the segment.

<static> JXG.Math.Geometry.projectPointToBoard(point, board)

Parameters:
{JXG.Point|JXG.Coords} point
{JXG.Board} board Optional

<static> {JXG.Coords} JXG.Math.Geometry.projectPointToCircle(point, circle, board)
Calculates the coordinates of the projection of a given point on a given circle. I.o.w. the nearest one of the two intersection points of the line through the given point and the circles center.

Parameters:
{JXG.Point|JXG.Coords} point
  Point to project or coords object to project.
{JXG.Circle} circle
  Circle on that the point is projected.
{JXG.Board} board Optional, Default: point.board
  Reference to the board

Returns:
  {JXG.Coords} The coordinates of the projection of the given point on the given circle.

<static> {JXG.Coords} JXG.Math.Geometry.projectPointToCurve(point, curve, board)
Calculates the coordinates of the projection of a given point on a given curve. Uses JXG.Math.Geometry.projectCoordsToCurve.

Parameters:
{JXG.Point} point
  Point to project.
{JXG.Curve} curve
  Curve on that the point is projected.
{JXG.Board} board Optional, Default: point.board
  Reference to a board.

Returns:
  {JXG.Coords} The coordinates of the projection of the given point on the given graph.

See:
  #projectCoordsToCurve

<static> {JXG.Coords} JXG.Math.Geometry.projectPointToLine(point, line, board)
Calculates the coordinates of the orthogonal projection of a given point on a given line. I.o.w. the intersection point of the given line and its perpendicular through the given point.

Parameters:
{JXG.Point} point
  Point to project.
{JXG.Line} line
  Line on that the point is projected.
{JXG.Board} board Optional, Default: point.board
  Reference to a board.

Returns:
  {JXG.Coords} The coordinates of the projection of the given point on the given line.

<static> {JXG.Coords} JXG.Math.Geometry.projectPointToPoint(point, dest)
Trivial projection of a point to another point.

Parameters:
{JXG.Point} point
  Point to project (not used).
{JXG.Point} dest
  Point on that the point is projected.

Returns:
  {JXG.Coords} The coordinates of the projection of the given point on the given circle.

<static> {JXG.Coords} JXG.Math.Geometry.projectPointToTurtle(point, turtle, board)
Calculates the coordinates of the projection of a given point on a given turtle. A turtle consists of one or more curves of curveType 'plot'. Uses JXG.Math.Geometry.projectPointToCurve.

Parameters:
{JXG.Point} point
  Point to project.
{JXG.Turtle} turtle
  on that the point is projected.
{JXG.Board} board Optional, Default: point.board
  Reference to a board.

Returns:
  {JXG.Coords} The coordinates of the projection of the given point on the given turtle.

<static> {Number} JXG.Math.Geometry.rad(A, B, C)
Calculates the internal angle defined by the three points A, B, C if you're going from A to C around B counterclockwise.

Parameters:
{JXG.Point|Array} A
  Point or [x,y] array
{JXG.Point|Array} B
  Point or [x,y] array
{JXG.Point|Array} C
  Point or [x,y] array

Returns:
  {Number} Angle in radians.

See:
  #trueAngle

<static> {JXG.Coords} JXG.Math.Geometry.reflection(line, point, board)
Reflects the point along the line.

Parameters:
{JXG.Line} line
  Axis of reflection.
{JXG.Point} point
  Point to reflect.
board Optional, Default: point.board
  Reference to the board

Returns:
  {JXG.Coords} Coordinates of the reflected point.

<static> {Array} JXG.Math.Geometry.reuleauxPolygon(points, nr)
Helper function to create curve which displays a Reuleaux polygons.

Parameters:
{Array} points
  Array of points which should be the vertices of the Reuleaux polygon. Typically, these point list is the array vertices of a regular polygon.
{Number} nr
  Number of vertices

Returns:
  {Array} An array containing the two functions defining the Reuleaux polygon and the two values for the start and the end of the paramtric curve. array may be used as parent array of a JXG.Curve.

Examples:

    var A = brd.create('point',[-2,-2]);
    var B = brd.create('point',[0,1]);
    var pol = brd.create('regularpolygon',[A,B,3], {withLines:false, fillColor:'none', highlightFillColor:'none', fillOpacity:0.0});
    var reuleauxTriangle = brd.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol.vertices, 3),
                             {strokeWidth:6, strokeColor:'#d66d55', fillColor:'#ad5544', highlightFillColor:'#ad5544'});

<static> {JXG.Coords} JXG.Math.Geometry.rotation(rotpoint, point, phi, board)
Computes the new position of a point which is rotated around a second point (called rotpoint) by the angle phi.

Parameters:
{JXG.Point} rotpoint
  Center of the rotation
{JXG.Point} point
  point to be rotated
{Number} phi
  rotation angle in arc length
{JXG.Board} board Optional, Default: point.board
  Reference to the board

Returns:
  {JXG.Coords} Coordinates of the new position.

<static> {Number} JXG.Math.Geometry.signedPolygon(p, sort)
Determine the signed area of a non-intersecting polygon. Surveyor's Formula

Parameters:
{Array} p
  An array containing JXG.Point, JXG.Coords, and/or arrays.
{Boolean} sort Optional, Default: true

Returns:
  {Number}

<static> {Number} JXG.Math.Geometry.signedTriangle(p1, p2, p3)
Signed triangle area of the three points given.

Parameters:
{JXG.Point|JXG.Coords|Array} p1
{JXG.Point|JXG.Coords|Array} p2
{JXG.Point|JXG.Coords|Array} p3

Returns:
  {Number}

<static> {Array} JXG.Math.Geometry.sortVertices(p)
Sort vertices counter clockwise starting with the point with the lowest y coordinate.

Parameters:
{Array} p
  An array containing JXG.Point, JXG.Coords, and/or arrays.

Returns:
  {Array}

<static> {Number} JXG.Math.Geometry.trueAngle(A, B, C)
Calculates the angle defined by the three points A, B, C if you're going from A to C around B counterclockwise.

Parameters:
{JXG.Point|Array} A
  Point or [x,y] array
{JXG.Point|Array} B
  Point or [x,y] array
{JXG.Point|Array} C
  Point or [x,y] array

Returns:
  {Number} The angle in degrees.

See:
  #rad