Namespace JXG.Math.Geometry
↳ JXG.Math.Geometry
Defined in: geometry.js.
Constructor Attributes  Constructor Name and Description 

Math.Geometry namespace definition.

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> 
JXG.Math.Geometry.affineRatio(a, b, c)
Affine ratio of three collinear points a, b, c: (c  a) / (b  a).

<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 coordinate points A, B, C, each defined by an array 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()

<private> <static> 
JXG.Math.Geometry.coordsOnArc(arc, coords)
Returns true if the coordinates are on the arc element,
false otherwise.

<static> 
JXG.Math.Geometry.det3p(p1, p2, q)
Determinant of three points in the Euclidean plane.

<static> 
JXG.Math.Geometry.distance(array1, array2, n)
Calculates the Euclidean distance 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.distPointSegment(q, p1, p2)
Determine the (Euclidean) distance between a point q and a line segment
defined by two points p1 and p2.

<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.intersectionFunction3D(view, el1, el2, i)
Generate the function which computes the data of the intersection.

<static> 
JXG.Math.Geometry.isSameDir(p1, p2, i1, i2)
The vectors p2p1 and i2i1 are supposed to be collinear.

<static> 
JXG.Math.Geometry.isSameDirection(start, p, s)
If you're looking from point "start" towards point "s" and you can see the point "p", return true.

<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 nrth intersection point of two Bezier curves, i.e.

<static> 
JXG.Math.Geometry.meetBeziersegmentBeziersegment(red, blue, testSegment)
Find the nrth 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.

<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 nth 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.meetPathPath(path1, path2, n, board)
Find the nth intersection point of two pathes, usually given by polygons.

<static> 
JXG.Math.Geometry.meetPolygonLine(path, line, nr, board, alwaysIntersect)
Find the nth intersection point between a polygon and a line.

<static> 
JXG.Math.Geometry.meetSegmentSegment(p1, p2, q1, q2)
(Virtual) 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.pnpoly(x_in, y_in, path, coord_type)
Decides if a point (x,y) is inside of a path / polygon.

<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.projectCoordsToParametric(pScr, target, params)
Given a the coordinates of a point, finds the nearest point on the given
parametric curve or surface, and returns its viewspace coordinates.

<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.projectScreenCoordsToParametric(pScr, target, params)
Given a the screen coordinates of a point, finds the point on the
given parametric curve or surface which is nearest in screen space,
and returns its viewspace coordinates.

<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 nonselfintersecting 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 first point.

<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.

<static> 
JXG.Math.Geometry.windingNumber(usrCoords, path, doNotClosePath)
Winding number of a point in respect to a polygon path.

Namespace Detail
JXG.Math.Geometry
Math.Geometry namespace definition. This namespace holds geometrical algorithms,
especially intersection algorithms.
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.affineRatio(a, b, c)
Affine ratio of three collinear points a, b, c: (c  a) / (b  a).
If r > 1 or r < 0 then c is outside of the segment ab.
 Parameters:
 {ArrayJXG.Coords} a
 {ArrayJXG.Coords} b
 {ArrayJXG.Coords} c
 Returns:
 {Number} affine ratio (c  a) / (b  a)
<static>
{Number}
JXG.Math.Geometry.angle(A, B, C)
Calculates the angle defined by the points A, B, C.
 Parameters:
 {JXG.PointArray} A
 A point or [x,y] array.
 {JXG.PointArray} B
 Another point or [x,y] array.
 {JXG.PointArray} 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 coordinate points A, B, C, each defined by an array 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.
<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
<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.
<private> <static>
{Boolean}
JXG.Math.Geometry.coordsOnArc(arc, coords)
Returns true if the coordinates are on the arc element,
false otherwise. Usually, coords is an intersection
on the circle line. Now it is decided if coords are on the
circle restricted to the arc line.
 Parameters:
 {Arc} arc
 arc or sector element
 {JXG.Coords} coords
 Coords object of an intersection
 Returns:
 {Boolean}
<static>
{Number}
JXG.Math.Geometry.det3p(p1, p2, q)
Determinant of three points in the Euclidean plane.
Zero, if the points are collinear. Used to determine of a point q is left or
right to a segment defined by points p1 and p2.
Nonhomogeneous version.
 Parameters:
 {ArrayJXG.Point} p1
 First point or its coordinates of the segment. Point object or array of length 3. First (homogeneous) coordinate is equal to 1.
 {ArrayJXG.Point} p2
 Second point or its coordinates of the segment. Point object or array of length 3. First (homogeneous) coordinate is equal to 1.
 {ArrayJXG.Point} q
 Point or its coordinates. Point object or array of length 3. First (homogeneous) coordinate is equal to 1.
 Returns:
 {Number} Signed area of the triangle formed by these three points.
 See:
 #windingNumber
<static>
{Number}
JXG.Math.Geometry.distance(array1, array2, n)
Calculates the Euclidean distance 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>
{Number}
JXG.Math.Geometry.distPointSegment(q, p1, p2)
Determine the (Euclidean) distance between a point q and a line segment
defined by two points p1 and p2. In case p1 equals p2, the distance to this
point is returned.
 Parameters:
 {Array} q
 Homogeneous coordinates of q
 {Array} p1
 Homogeneous coordinates of p1
 {Array} p2
 Homogeneous coordinates of p2
 Returns:
 {Number} Distance of q to line segment [p1, p2]
<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.LineJXG.Circle_JXG.LineJXG.Circle_NumberFunction} 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.
 {Boolean} alwaysintersect.
 Flag that determines if segments 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>
JXG.Math.Geometry.intersectionFunction3D(view, el1, el2, i)
Generate the function which computes the data of the intersection.
 Parameters:
 view
 el1
 el2
 i
<static>
{Boolean}
JXG.Math.Geometry.isSameDir(p1, p2, i1, i2)
The vectors p2p1 and i2i1 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 p2p1 and i2i1 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 you can see the point "p", return true.
Otherwise return 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 sstart = k*(pstart) 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)
 {NumberFunction} 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 nrth 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
 {NumberFunction} nr
 The number of the intersection point which should be returned.
 Returns:
 {Array} The homogeneous coordinates of the nrth intersection point.
<static>
{Array}
JXG.Math.Geometry.meetBeziersegmentBeziersegment(red, blue, testSegment)
Find the nrth 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
 {numberfunction} 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: segmentwise intersections (default) or generalized Newton method.
 Parameters:
 {JXG.Curve} c1
 Curve, Line or Circle
 {JXG.Curve} c2
 Curve, Line or Circle
 {NumberFunction} nr
 the nrth 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.CurveJXG.Line} el1
 Curve or Line
 {JXG.CurveJXG.Line} el2
 Curve or Line
 {NumberFunction} nr
 the nrth 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.Coords}
JXG.Math.Geometry.meetCurveLineContinuous(cu, li, nr, board, testSegment)
Intersection of line and curve, continuous case.
Finds the nrthe 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
 {NumberFunction} nr
 Will return the nrth intersection point.
 {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} Coords object containing the intersection.
<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 nrth intersection point should work for all nr.
 Parameters:
 {JXG.Curve} cu
 {JXG.Line} li
 {NumberFunction} 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 nth 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 segment 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 nth 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.
<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
 {numberfunction} 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>
{JXG.Coords}
JXG.Math.Geometry.meetPathPath(path1, path2, n, board)
Find the nth intersection point of two pathes, usually given by polygons. Uses parts of the
GreinerHormann algorithm in JXG.Math.Clip.
 Parameters:
 {JXG.CircleJXG.CurveJXG.Polygon} path1
 {JXG.CircleJXG.CurveJXG.Polygon} path2
 {NumberFunction} n
 {JXG.Board} board
 Returns:
 {JXG.Coords} Intersection point. In case no intersection point is detected, the ideal point [0,0,0] is returned.
<static>
{JXG.Coords}
JXG.Math.Geometry.meetPolygonLine(path, line, nr, board, alwaysIntersect)
Find the nth intersection point between a polygon and a line.
 Parameters:
 {JXG.Polygon} path
 {JXG.Line} line
 {NumberFunction} nr
 {JXG.Board} board
 {Boolean} alwaysIntersect
 If false just the segment between the two defining points of the line are tested for intersection.
 Returns:
 {JXG.Coords} Intersection point. In case no intersection point is detected, the ideal point [0,0,0] is returned.
<static>
{Array}
JXG.Math.Geometry.meetSegmentSegment(p1, p2, q1, q2)
(Virtual) Intersection of two segments.
 Parameters:
 {Array} p1
 First point of segment 1 using normalized homogeneous coordinates [1,x,y]
 {Array} p2
 Second point or direction of segment 1 using normalized homogeneous coordinates [1,x,y] or point at infinity [0,x,y], respectively
 {Array} q1
 First point of segment 2 using normalized homogeneous coordinates [1,x,y]
 {Array} q2
 Second point or direction of segment 2 using normalized homogeneous coordinates [1,x,y] or point at infinity [0,x,y], respectively
 Returns:
 {Array} [Intersection point, t, u] The first entry contains the homogeneous coordinates of the intersection point. The second and third entry give the position of the intersection with respect to the definiting parameters. For example, the second entry t is defined by: intersection point = p1 + t * deltaP, where deltaP = (p2  p1) when both parameters are coordinates, and deltaP = p2 if p2 is a point at infinity. If the two segments are collinear, [[0,0,0], Infinity, Infinity] is returned.
<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>
{Boolean}
JXG.Math.Geometry.pnpoly(x_in, y_in, path, coord_type)
Decides if a point (x,y) is inside of a path / polygon.
Does not work correct if the path has hole. In this case, windingNumber is the preferred method.
Implements W. Randolf Franklin's pnpoly method.
See https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html.
 Parameters:
 {Number} x_in
 xcoordinate (screen or user coordinates)
 {Number} y_in
 ycoordinate (screen or user coordinates)
 {Array} path
 Array of points / coords determining a path, i.e. the vertices of the polygon / path. The array elements do not have to be full points, but have to have a subobject "coords" or should be of type JXG.Coords.
 {Number} coord_type Optional, Default: JXG.COORDS_BY_SCREEN
 Type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN. Default value is JXG.COORDS_BY_SCREEN.
 Returns:
 {Boolean} if (x_in, y_in) is inside of the polygon.
 See:
 JXG.Polygon.hasPoint
 JXG.Polygon.pnpoly
 #windingNumber
 Examples:
var pol = board.create('polygon', [[1,2], [2,2], [1,4]]); var p = board.create('point', [4, 3]); var txt = board.create('text', [1, 0.5, function() { return 'Point A is inside of the polygon = ' + JXG.Math.Geometry.pnpoly(p.X(), p.Y(), JXG.COORDS_BY_USER, pol.vertices); }]);
<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 yaxis 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 curve and the position on the curve.
 See:
 #projectPointToCurve
<static>
{Array}
JXG.Math.Geometry.projectCoordsToParametric(pScr, target, params)
Given a the coordinates of a point, finds the nearest point on the given
parametric curve or surface, and returns its viewspace coordinates.
 Parameters:
 {Array} pScr
 Screen coordinates to project.
 {JXG.Curve3DJXG.Surface3D} target
 Parametric curve or surface to project to.
 {Array} params
 Parameters of point on the target, initially specifying the starting point of the search. The parameters are modified in place during the search, ending up at the nearest point.
 Returns:
 {Array} Array of length 4 containing the coordinates of the nearest point on the curve or surface.
<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.PointJXG.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.PointJXG.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>
{Array}
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:
 {Array} [JXG.Coords, position] The coordinates of the projection of the given point on the given graph and the relative position on the curve (real number).
 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.PointJXG.Coords} point
 Point to project.
 {JXG.Line} line
 Line on that the point is projected.
 {JXG.Board} board Optional, Default: point.boardboard=line.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>
{Array}
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:
 {Array} [JXG.Coords, position] Array containing the coordinates of the projection of the given point on the turtle and the position on the turtle.
<static>
{Array}
JXG.Math.Geometry.projectScreenCoordsToParametric(pScr, target, params)
Given a the screen coordinates of a point, finds the point on the
given parametric curve or surface which is nearest in screen space,
and returns its viewspace coordinates.
 Parameters:
 {Array} pScr
 Screen coordinates to project.
 {JXG.Curve3DJXG.Surface3D} target
 Parametric curve or surface to project to.
 {Array} params
 Parameters of point on the target, initially specifying the starting point of the search. The parameters are modified in place during the search, ending up at the nearest point.
 Returns:
 {Array} Array of length 4 containing the coordinates of the nearest point on the curve or surface.
<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.PointArray} A
 Point or [x,y] array
 {JXG.PointArray} B
 Point or [x,y] array
 {JXG.PointArray} 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 nonselfintersecting 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.PointJXG.CoordsArray} p1
 {JXG.PointJXG.CoordsArray} p2
 {JXG.PointJXG.CoordsArray} p3
 Returns:
 {Number}
<static>
{Array}
JXG.Math.Geometry.sortVertices(p)
Sort vertices counter clockwise starting with the first point.
 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.PointArray} A
 Point or [x,y] array
 {JXG.PointArray} B
 Point or [x,y] array
 {JXG.PointArray} C
 Point or [x,y] array
 Returns:
 {Number} The angle in degrees.
 See:
 #rad
<static>
{Number}
JXG.Math.Geometry.windingNumber(usrCoords, path, doNotClosePath)
Winding number of a point in respect to a polygon path.
The point is regarded outside if the winding number is zero,
inside otherwise. The algorithm tries to find degenerate cases, i.e.
if the point is on the path. This is regarded as "outside".
If the point is a vertex of the path, it is regarded as "inside".
Implementation of algorithm 7 from "The point in polygon problem for
arbitrary polygons" by Kai Hormann and Alexander Agathos, Computational Geometry,
Volume 20, Issue 3, November 2001, Pages 131144.
 Parameters:
 {Array} usrCoords
 Homogenous coordinates of the point
 {Array} path
 Array of points / coords determining a path, i.e. the vertices of the polygon / path. The array elements do not have to be full points, but have to have a subobject "coords" or should be of type JXG.Coords.
 {Boolean} doNotClosePath Optional, Default: false
 If true the last point of the path is not connected to the first point. This is necessary if the path consists of two or more closed subpaths, e.g. if the figure has a hole.
 Returns:
 {Number} Winding number of the point. The point is regarded outside if the winding number is zero, inside otherwise.