Namespace JXG.Math.Geometry
Defined in: MathGeometry.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Math.Geometry namespace definition
|
Field Attributes | Field Name and Description |
---|---|
<static> |
JXG.Math.Geometry.circumcenterMidpoint
|
Method Attributes | Method Name and Description |
---|---|
<static> |
JXG.Math.Geometry.affineDistance(array1, array2)
Calculates euclidean distance for two given arrays of the same length.
|
<static> |
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 the bisection between the three points A, B, C.
|
<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> |
JXG.Math.Geometry.distance(array1, array2)
Calculates 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.intersectCircleCircle(circle1, circle2, board)
Calculates the coordinates of the intersection of the given circles.
|
<static> |
JXG.Math.Geometry.intersectCircleLine(circle, line, board)
Calculates the coordinates of the intersection of the given line and circle.
|
<static> |
JXG.Math.Geometry.intersectLineLine(line1, line2, board)
Calculates the coordinates of the intersection of the given lines.
|
<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.meetCircleCircle(circ1, circ2, i, board)
Intersection of two circles using the stdform.
|
<static> |
JXG.Math.Geometry.meetCurveCurve(c1, c2, t1ini, t2ini, board)
Compute an intersection of the curves c1 and c2
with a generalized Newton method.
|
<static> |
JXG.Math.Geometry.meetCurveLine(el1, el2, nr, board, pointObj)
Intersection of curve with line,
Order of input does not matter for el1 and el2.
|
<static> |
JXG.Math.Geometry.meetCurveLineContinuous(cu, li, nr, board)
Intersection of line and curve, continuous case.
|
<static> |
JXG.Math.Geometry.meetCurveLineDiscrete(cu, li, nr, board, pointObj)
Intersection of line and curve, continuous case.
|
<static> |
JXG.Math.Geometry.meetLineCircle(lin, circ, i, board)
Intersection of line and circle using the stdform.
|
<static> |
JXG.Math.Geometry.meetLineLine(l1, l2, i, board)
Intersection of two lines using the stdform.
|
<static> |
JXG.Math.Geometry.meetSegmentSegment(p1, p2, q1, q2, board)
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.projectCoordsToCurve(x, y, t, curve, board)
Calculates the coordinates of the projection of a coordinates pair on a given curve.
|
<static> |
JXG.Math.Geometry.projectCoordsToSegment(p1, 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.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, board)
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.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.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.
|
Field Detail
<static>
JXG.Math.Geometry.circumcenterMidpoint
- Deprecated:
- Please use JXG.Math.Geometry#circumcenter instead.
Method Detail
<static>
{Number}
JXG.Math.Geometry.affineDistance(array1, array2)
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 number.
- {Array} array2
- Array containing elements of type number.
- 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} A
- A point or [x,y] array.
- {JXG.Point} B
- Another point or [x,y] array.
- {JXG.Point} 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 the bisection between the three points A, B, C. The bisection is defined by two points:
Parameter B and a point with the coordinates calculated in this function.
- 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.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.
<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>
{Number}
JXG.Math.Geometry.distance(array1, array2)
Calculates euclidean norm for two given arrays of the same length.
- Parameters:
- {Array} array1
- Array of float or integer.
- {Array} array2
- Array of float or integer.
- 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.intersectCircleCircle(circle1, circle2, board)
Calculates the coordinates of the intersection of the given circles.
- Parameters:
- {JXG.Circle} circle1
- Circle.
- {JXG.Circle} circle2
- Circle.
- {JXG.Board} board Optional, Default: circle1.board
- Reference to the board
- Returns:
- {Array} Coordinates of the intersection points of the given circles and the amount of intersection points in the first component of the array.
<static>
{Array}
JXG.Math.Geometry.intersectCircleLine(circle, line, board)
Calculates the coordinates of the intersection of the given line and circle.
- Parameters:
- {JXG.Circle} circle
- Circle.
- {JXG.Line} line
- Line.
- {JXG.Board} board Optional, Default: line.board
- Reference to the board
- Returns:
- {Array} The coordinates of the intersection points of the given circle with the given line and the amount of intersection points in the first component of the array.
<static>
{JXG.Coords}
JXG.Math.Geometry.intersectLineLine(line1, line2, board)
Calculates the coordinates of the intersection of the given lines.
- Parameters:
- {JXG.Line} line1
- Line.
- {JXG.Line} line2
- Line.
- {JXG.Board} board Optional, Default: line1.board
- Reference to the board
- Returns:
- {JXG.Coords} Coordinates of the intersection point of the given lines.
<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>
{JXG.Coords}
JXG.Math.Geometry.meetCircleCircle(circ1, circ2, i, board)
Intersection of two circles using the stdform.
- 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, t1ini, t2ini, board)
Compute an intersection of the curves c1 and c2
with a generalized Newton method.
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).
We set
(e,f) := (c1_x(t1)-c2_x(t2),c1_y(t1)-c2_y(t2))
The Jacobian J is defined by
J = (a, b)
(c, d)
where
a = c1_x'(t1)
b = -c2_x'(t2)
c = c1_y'(t1)
d = -c2_y'(t2)
The inverse J^(-1) of J is equal to
(d, -b)/
(-c, a) / (ad-bc)
Then, (t1new, t2new) := (t1,t2) - J^(-1)*(e,f).
If the function meetCurveCurve possesses the properties
t1memo and t2memo then these are taken as start values
for the Newton algorithm.
After stopping of the Newton algorithm the values of t1 and t2 are stored in
t1memo and t2memo.
- Parameters:
- {JXG.Curve} c1
- Curve, Line or Circle
- {JXG.Curve} c2
- Curve, Line or Circle
- {Number} t1ini
- start value for t1
- {Number} t2ini
- start value for t2
- {JXG.Board} board Optional, Default: c1.board
- Reference to a board object.
- Returns:
- {JXG.Coords} intersection point
<static>
{JXG.Coords}
JXG.Math.Geometry.meetCurveLine(el1, el2, nr, board, pointObj)
Intersection of curve with line,
Order of input does not matter for el1 and el2.
- 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.
- pointObj
- 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)
Intersection of line and curve, continuous case.
Segments are treated as lines. Finding the nr-the intersection point
works for nr=0,1 only.
BUG: does not respect cu.minX() and cu.maxX()
- Parameters:
- cu
- li
- nr
- board
<static>
JXG.Math.Geometry.meetCurveLineDiscrete(cu, li, nr, board, pointObj)
Intersection of line and curve, continuous case.
Segments are treated as lines.
Finding the nr-the intersection point should work for all nr.
- Parameters:
- cu
- li
- nr
- board
- pointObj
<static>
{JXG.Coords}
JXG.Math.Geometry.meetLineCircle(lin, circ, i, board)
Intersection of line and circle using the stdform.
- 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 using the stdform.
- 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, board)
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]
- board
- 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: interestion point = t*p1 + (1-t)*p2.
<static>
{JXG.Coords}
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
- Intersection point of line to perpendicular.
- {JXG.Board} board Optional, Default: point.board
- Reference to the board
- Returns:
- {JXG.Coords} Coordinates of a point on the perpendicular to the given line through the given 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.projectCoordsToSegment(p1, 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} p1
- 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.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 #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, board)
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.
- {JXG.Board} board Optional, Default: point.board
- Reference to the board (not used).
- 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 #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} A
- Point or [x,y] array
- {JXG.Point} B
- Point or [x,y] array
- {JXG.Point} 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>
{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.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} A
- Point or [x,y] array
- {JXG.Point} B
- Point or [x,y] array
- {JXG.Point} C
- Point or [x,y] array
- Returns:
- {Number} The angle in degrees.
- See:
- #rad