Class JXG.View3D
JXG.GeometryElement
↳ JXG.View3D
Creates a new 3D view. Do not use this constructor to create a 3D view. Use JXG.Board#create with
type View3D instead.
Defined in: view3d.js.
Extends
JXG.GeometryElement.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.View3D(parents, parents, attributes)
3D view inside of a JXGraph board.
|
- Fields borrowed from class JXG.GeometryElement:
- _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, precision, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, visible, visProp, visPropCalc, withLabel
Field Attributes | Field Name and Description |
---|---|
Slider to adapt azimuth angle
|
|
Bounding box (cube) [[x1, x2], [y1,y2], [z1,z2]] of the 3D view
|
|
Default axes of the 3D view, contains the axes of the view or null.
|
|
Slider to adapt elevation angle
|
|
<private> |
An associative array / dictionary to store the objects of the board by name.
|
<private> |
Lower left corner [x, y] of the 3D view if elevation and azimuth are set to 0.
|
<private> |
3D-to-2D transformation matrix
|
<private> |
An associative array containing all geometric objects belonging to the view.
|
<private> |
An array containing all geometric objects in this view in the order of construction.
|
Distance of the view to the origin.
|
|
<private> |
Width and height [w, h] of the 3D view if elevation and azimuth are set to 0.
|
- Fields borrowed from class JXG.GeometryElement:
- _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, precision, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, visible, visProp, visPropCalc, withLabel
Method Attributes | Method Name and Description |
---|---|
create(elementType, parents, attributes)
Creates a new 3D element of type elementType.
|
|
<private> |
getMesh(func, interval_u, interval_v)
Generate mesh for a surface / plane.
|
intersectionLineCube(p, d, r)
Intersect a ray with the bounding cube of the 3D view.
|
|
intersectionPlanePlane(plane1, plane2, d)
|
|
isInCube(q)
Test if coordinates are inside of the bounding cube.
|
|
project2DTo3DPlane(point, normal, foot)
Project a 2D coordinate to the plane defined by the point foot
and the normal vector `normal`.
|
|
project3DTo2D(x, y, z)
Project 3D coordinates to 2D board coordinates
The 3D coordinates are provides as three numbers x, y, z or one array of length 3.
|
|
project3DToCube(c3d)
Limit 3D coordinates to the bounding cube.
|
|
select(str, onlyByIdOrName)
Select a single or multiple elements at once.
|
|
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getSnapSizes, getTextAnchor, getType, handleSnapToGrid, hasPoint, hide, hideElement, labelColor, noHighlight, normalize, prepareUpdate, remove, removeAllTicks, removeChild, removeDescendants, removeTicks, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, show, showElement, snapToPoints, update, updateRenderer, updateVisibility
- Events borrowed from class JXG.GeometryElement:
- attribute, attribute:key, down, drag, keydrag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, pendown, pendrag, penup, touchdown, touchdrag, touchup, up
Class Detail
JXG.View3D(parents, parents, attributes)
3D view inside of a JXGraph board.
- Parameters:
- {Array} parents
- Array consisting of lower left corner [x, y] of the view inside the board, [width, height] of the view and box size [[x1, x2], [y1,y2], [z1,z2]]. If the view's azimuth=0 and elevation=0, the 3D view will cover a rectangle with lower left corner [x,y] and side lengths [w, h] of the board.
- parents
- attributes
Field Detail
az_slide
Slider to adapt azimuth angle
{array}
bbox3D
Bounding box (cube) [[x1, x2], [y1,y2], [z1,z2]] of the 3D view
defaultAxes
Default axes of the 3D view, contains the axes of the view or null.
- Default Value:
- null
el_slide
Slider to adapt elevation angle
<private>
{Object}
elementsByName
An associative array / dictionary to store the objects of the board by name. The name of the object is the key and value is a reference to the object.
<private>
{array}
llftCorner
Lower left corner [x, y] of the 3D view if elevation and azimuth are set to 0.
<private>
{3 x 4 matrix}
matrix3D
3D-to-2D transformation matrix
<private>
{Object}
objects
An associative array containing all geometric objects belonging to the view.
Key is the id of the object and value is a reference to the object.
<private>
{Array}
objectsList
An array containing all geometric objects in this view in the order of construction.
{Number}
r
Distance of the view to the origin. In other words, its
the radius of the sphere where the camera sits.view.board.update
<private>
{array}
size
Width and height [w, h] of the 3D view if elevation and azimuth are set to 0.
Method Detail
animateAzimuth()
{Object}
create(elementType, parents, attributes)
Creates a new 3D element of type elementType.
- Parameters:
- {String} elementType
- Type of the element to be constructed given as a string e.g. 'point3d' or 'surface3d'.
- {Array} parents
- Array of parent elements needed to construct the element e.g. coordinates for a 3D point or two 3D points to construct a line. This highly depends on the elementType that is constructed. See the corresponding JXG.create* methods for a list of possible parameters.
- {Object} attributes Optional
- An object containing the attributes to be set. This also depends on the elementType. Common attributes are name, visible, strokeColor.
- Returns:
- {Object} Reference to the created element. This is usually a GeometryElement3D, but can be an array containing two or more elements.
<private>
getMesh(func, interval_u, interval_v)
Generate mesh for a surface / plane.
Returns array [dataX, dataY] for a JSXGraph curve's updateDataArray function.
- Parameters:
- {Array|Function} func
- {Array} interval_u
- {Array} interval_v
- Returns:
- Array
- Examples:
var el = view.create('curve', [[], []]); el.updateDataArray = function () { var steps_u = Type.evaluate(this.visProp.stepsu), steps_v = Type.evaluate(this.visProp.stepsv), r_u = Type.evaluate(this.range_u), r_v = Type.evaluate(this.range_v), func, ret; if (this.F !== null) { func = this.F; } else { func = [this.X, this.Y, this.Z]; } ret = this.view.getMesh(func, r_u.concat([steps_u]), r_v.concat([steps_v])); this.dataX = ret[0]; this.dataY = ret[1]; };
intersectionLineCube(p, d, r)
Intersect a ray with the bounding cube of the 3D view.
- Parameters:
- {Array} p
- 3D coordinates [x,y,z]
- {Array} d
- 3D direction vector of the line (array of length 3)
- {Number} r
- direction of the ray (positive if r > 0, negative if r < 0).
- Returns:
- Affine ratio of the intersection of the line with the cube.
{Array}
intersectionPlanePlane(plane1, plane2, d)
- Parameters:
- {JXG.Plane3D} plane1
- {JXG.Plane3D} plane2
- {JXG.Plane3D} d
- Returns:
- {Array} of length 2 containing the coordinates of the defining points of of the intersection segment.
isInCube(q)
Test if coordinates are inside of the bounding cube.
- Parameters:
- {array} q
- 3D coordinates [x,y,z] of a point.
- Returns:
- Boolean
{Array}
project2DTo3DPlane(point, normal, foot)
Project a 2D coordinate to the plane defined by the point foot
and the normal vector `normal`.
- Parameters:
- {JXG.Point} point
- {Array} normal
- {Array} foot
- Returns:
- {Array} of length 4 containing the projected point in homogeneous coordinates.
{Array}
project3DTo2D(x, y, z)
Project 3D coordinates to 2D board coordinates
The 3D coordinates are provides as three numbers x, y, z or one array of length 3.
- Parameters:
- {Number|Array} x
- {[Number]} y
- {[Number]} z
- Returns:
- {Array} Array of length 3 containing the projection on to the board in homogeneous user coordinates.
project3DToCube(c3d)
Limit 3D coordinates to the bounding cube.
- Parameters:
- {Array} c3d
- 3D coordinates [x,y,z]
- Returns:
- Array with updated 3D coordinates.
{JXG.GeometryElement3D|JXG.Composition}
select(str, onlyByIdOrName)
Select a single or multiple elements at once.
- Parameters:
- {String|Object|function} str
- The name, id or a reference to a JSXGraph 3D element in the 3D view. An object will be used as a filter to return multiple elements at once filtered by the properties of the object.
- {Boolean} onlyByIdOrName
- If true (default:false) elements are only filtered by their id, name or groupId. The advanced filters consisting of objects or functions are ignored.
- Returns:
- {JXG.GeometryElement3D|JXG.Composition}
- Examples:
// select the element with name A view.select('A'); // select all elements with strokecolor set to 'red' (but not '#ff0000') view.select({ strokeColor: 'red' }); // select all points on or below the x/y plane and make them black. view.select({ elType: 'point3d', Z: function (v) { return v <= 0; } }).setAttribute({color: 'black'}); // select all elements view.select(function (el) { return true; });
stopAzimuth()