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.
|
<private> <static> |
JXG.Math.Geometry._paramsOutOfRange(params, r_u, r_v)
Test if parameters are inside of allowed ranges
|
<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()
|
<static> |
JXG.Math.Geometry.convexHull(points, returnCoords)
Calculate the complex hull of a point cloud by the Graham scan algorithm.
|
<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 by the Graham scan algorithm.
|
<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(el1, el2, el2)
Generate the function which computes the data of the intersection between
|
<static> |
JXG.Math.Geometry.isConvex(points)
Determine if a polygon or a path element is convex:
A polygon is convex if for every pair of points, the line segment connecting them does not intersect an edge of the polygon in one 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 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.meet3Planes(n1, d1, n2, d2, n3, d3)
Intersecting point of three planes in 3D.
|
<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.
|
<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.meetPathPath(path1, path2, n, board)
Find the n-th intersection point of two pathes, usually given by polygons.
|
<static> |
JXG.Math.Geometry.meetPlanePlane(v11, v12, v21, v22)
Direction of intersecting line of two planes in 3D.
|
<static> |
JXG.Math.Geometry.meetPolygonLine(path, line, nr, board, alwaysIntersect)
Find the n-th 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, board)
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(p, target, params, params)
Given the 2D screen coordinates of a point, finds the nearest point on the given
parametric curve or surface, and returns its view-space 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.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-self-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 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.
|
- 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]
- 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
- Parameters:
- L
- Lnew
- t1
- t2
- 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.
- 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.
- 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.
- Parameters:
- {Array} params
- Array of length 1 or 2
- {Array} r_u
- First range
- {Array} r_v Optional
- Second range
- Returns:
- Boolean
- 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.
- Parameters:
- {Array|JXG.Coords} a
- {Array|JXG.Coords} b
- {Array|JXG.Coords} c
- Returns:
- {Number} affine ratio (c - a) / (b - a)
- 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.
- 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.
- 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.
- Parameters:
- {number} angle
- angle in radians. Must be in range (-2pi,2pi).
- 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.
- 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
- 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.
- Deprecated:
- Please use JXG.Math.Geometry.circumcenter instead.
- Parameters:
- {Array} points
- An array containing JXG.Point, JXG.Coords, and/or arrays.
- {Boolean} returnCoords Optional, Default: false
- If true, return an array of coords. Otherwise return a list of pointers to the input list elements. That is, if the input is a list of JXG.Point elements, the returned list will contain the points that form the convex hull.
- Returns:
- {Array} List containing the convex hull. Format depends on returnCoords.
- Examples:
// Static example var i, hull, p = []; p.push( board.create('point', [4, 0], {withLabel:false }) ); p.push( board.create('point', [0, 4], {withLabel:false }) ); p.push( board.create('point', [0, 0], {withLabel:false }) ); p.push( board.create('point', [1, 1], {withLabel:false }) ); hull = JXG.Math.Geometry.convexHull(p); for (i = 0; i < hull.length; i++) { hull[i].setAttribute({color: 'blue'}); }
// Dynamic version using returnCoords==true: drag the points var p = []; p.push( board.create('point', [4, 0], {withLabel:false }) ); p.push( board.create('point', [0, 4], {withLabel:false }) ); p.push( board.create('point', [0, 0], {withLabel:false }) ); p.push( board.create('point', [1, 1], {withLabel:false }) ); var c = board.create('curve', [[], []], {fillColor: 'yellow', fillOpacity: 0.3}); c.updateDataArray = function() { var i, hull = JXG.Math.Geometry.convexHull(p, true); this.dataX = []; this.dataY = []; for (i = 0; i < hull.length; i ++) { this.dataX.push(hull[i][1]); this.dataY.push(hull[i][2]); } this.dataX.push(hull[0][1]); this.dataY.push(hull[0][2]); }; board.update();
- Parameters:
- {Arc} arc
- arc or sector element
- {JXG.Coords} coords
- Coords object of an intersection
- Returns:
- {Boolean}
Non-homogeneous version.
- Parameters:
- {Array|JXG.Point} p1
- First point or its coordinates of the segment. Point object or array of length 3. First (homogeneous) coordinate is equal to 1.
- {Array|JXG.Point} p2
- Second point or its coordinates of the segment. Point object or array of length 3. First (homogeneous) coordinate is equal to 1.
- {Array|JXG.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.
- 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.
- 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.
- 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]
- Parameters:
- {Array} points
- An array containing JXG.Point, JXG.Coords, and/or arrays.
- Returns:
- {Array} List of objects
{i: index, c: coords}
containing the convex hull points in form of the index in the original input array and a coords array.
- Examples:
// Static example var i, hull, p = [], q = []; p.push( board.create('point', [4, 0], {withLabel:false }) ); p.push( board.create('point', [0, 4], {withLabel:false }) ); p.push( board.create('point', [0, 0], {withLabel:false }) ); p.push([-1, 0]); p.push([-3, -3]); hull = JXG.Math.Geometry.GrahamScan(p); for (i = 0; i < hull.length; i++) { console.log(hull[i]); q.push(hull[i].c); } board.create('polygon', q); // Output: // { i: 4, c: [1, -3, 3]} // { i: 0, c: [1, 4, 0]} // { i: 1, c: [1, 0, 4]}
- Parameters:
- {JXG.Board} board
- object
- {JXG.Line|JXG.Circle_JXG.Line|JXG.Circle_Number|Function} 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.
- See:
- JXG.Point.createIntersectionPoint
- plane3d, plane3d,
- plane3d, sphere3d,
- sphere3d, plane3d,
- sphere3d, sphere3d
- Parameters:
- {JXG.GeometryElement3D} el1
- Plane or sphere element
- {JXG.GeometryElement3D} el2
- Plane or sphere element
- el2
- Returns:
- {Array} of functions needed as input to create the intersecting line or circle.
A polygon is convex if for every pair of points, the line segment connecting them does not intersect an edge of the polygon in one point. A single line segment, a single point, or the empty set is considered as convex. A necessary condition for a polygon to be convex that the angle sum of its interior angles equals ± 2 π.
A path element might be specified as an array of coordinate arrays or JXG.Coords. See the discussion at stackoverflow.
- Parameters:
- {Array|Polygon|PolygonalChain} points
- Polygon or list of coordinates
- Returns:
- {Boolean} true if convex
- Examples:
var pol = board.create('polygon', [ [-1, -1], [3, -1], [4, 2], [3, 3], [0, 4], [-3, 1] ], { vertices: { color: 'blue', snapToGrid: true } }); console.log(JXG.Math.Geometry.isConvex(pol)); // > true
- 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
- 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.
- Parameters:
- {Array} el1
- stdform of the first element (line or circle)
- {Array} el2
- stdform of the second element (line or circle)
- {Number|Function} 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.
- Parameters:
- {Array} n1
- Hesse normal form vector of plane 1
- {Number} d1
- Hesse normal form right hand side of plane 1
- {Array} n2
- Hesse normal form vector of plane 2
- {Number} d2
- Hesse normal form right hand side of plane 2
- {Array} n3
- Hesse normal form vector of plane 1
- {Number} d3
- Hesse normal form right hand side of plane 3
- Returns:
- {Array} Coordinates array of length 4 of the intersecting point
- Parameters:
- {JXG.Curve} red
- Curve with bezierDegree == 3
- {JXG.Curve} blue
- Curve with bezierDegree == 3
- {Number|Function} nr
- The number of the intersection point which should be returned.
- Returns:
- {Array} The homogeneous coordinates of the nr-th intersection point.
- 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.
- Parameters:
- {Array} circ1
- stdform of the first circle
- {Array} circ2
- stdform of the second circle
- {number|function} 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
- Parameters:
- {JXG.Curve} c1
- Curve, Line or Circle
- {JXG.Curve} c2
- Curve, Line or Circle
- {Number|Function} 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
- Parameters:
- {JXG.Curve|JXG.Line} el1
- Curve or Line
- {JXG.Curve|JXG.Line} el2
- Curve or Line
- {Number|Function} 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.
- Parameters:
- {JXG.Curve} cu
- Curve
- {JXG.Line} li
- Line
- {NumberFunction} nr
- Will return the nr-th 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.
- Parameters:
- {JXG.Curve} cu
- {JXG.Line} li
- {Number|Function} 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.
This method works also for transformed curves, since only the already transformed points are used.
- 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]
- Parameters:
- {Array} lin
- stdform of the line
- {Array} circ
- stdform of the circle
- {number|function} 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
- 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.
- Parameters:
- {JXG.Circle|JXG.Curve|JXG.Polygon} path1
- {JXG.Circle|JXG.Curve|JXG.Polygon} path2
- {Number|Function} n
- {JXG.Board} board
- Returns:
- {JXG.Coords} Intersection point. In case no intersection point is detected, the ideal point [0,0,0] is returned.
- Parameters:
- {Array} v11
- First vector spanning plane 1 (homogeneous coordinates)
- {Array} v12
- Second vector spanning plane 1 (homogeneous coordinates)
- {Array} v21
- First vector spanning plane 2 (homogeneous coordinates)
- {Array} v22
- Second vector spanning plane 2 (homogeneous coordinates)
- Returns:
- {Array} Coordinates array of length 4 of the direction (homogeneous coordinates)
- Parameters:
- {JXG.Polygon} path
- {JXG.Line} line
- {Number|Function} 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.
- 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.
- 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".
- Parameters:
- {Number} x_in
- x-coordinate (screen or user coordinates)
- {Number} y_in
- y-coordinate (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.
- {JXG.Board} board
- Board object
- Returns:
- {Boolean} if (x_in, y_in) is inside of the polygon.
- 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(), pol.vertices, JXG.COORDS_BY_USER, board); }]);
- 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.
- 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.
- Parameters:
- {Array} p
- 3D coordinates for which the closest point on the curve point is searched.
- {JXG.Curve3D|JXG.Surface3D} target
- Parametric curve or surface to project to.
- {Array} params
- New position of point on the target (i.e. it is a return value), modified in place during the search, ending up at the nearest point. Usually, point.position is supplied for params.
- params
- Returns:
- {Array} Array of length 4 containing the coordinates of the nearest point on the curve or surface.
- 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.
- 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.
- Parameters:
- {JXG.Point|JXG.Coords} point
- {JXG.Board} board Optional
- 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.
- 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).
- Parameters:
- {JXG.Point|JXG.Coords} point
- Point to project.
- {JXG.Line} line
- Line on that the point is projected.
- {JXG.Board} board Optional, Default: point.board|board=line.board
- Reference to a board.
- Returns:
- {JXG.Coords} The coordinates of the projection of the given point on the given line.
- 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.
- 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.
- 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.
- 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.
- 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'});
- 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.
- Parameters:
- {Array} p
- An array containing JXG.Point, JXG.Coords, and/or arrays.
- {Boolean} sort Optional, Default: true
- Returns:
- {Number}
- If the return value is < 0, then the point p2 is left of the line [p1, p3] (i.e p3 is right from [p1, p2]).
- If the return value is > 0, then the point p2 is right of the line [p1, p3] (i.e p3 is left from [p1, p2]).
- If the return value is = 0, then the points p1, p2, p3 are collinear.
- Parameters:
- {JXG.Point|JXG.Coords|Array} p1
- {JXG.Point|JXG.Coords|Array} p2
- {JXG.Point|JXG.Coords|Array} p3
- Returns:
- {Number}
- Parameters:
- {Array} p
- An array containing JXG.Point, JXG.Coords, and/or arrays.
- Returns:
- {Array}
- 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.
- 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.