Class Scene
- java.lang.Object
-
- nub.core.Graph
-
- nub.processing.Scene
-
public class Scene extends Graph
A 2D or 3D interactive, on-screen or off-screen, Processing mouse-drivenGraph.Usage
Typical usage comprises two steps: scene instantiation and setting some nodes.Scene instantiation
Instantiate your on-screen scene at thePApplet.setup():
The sceneScene scene; void setup() { scene = new Scene(this); }context()corresponds to thePAppletmain canvas.Off-screen scenes should be instantiated upon a
PGraphicsobject:
In this case, the sceneScene scene; PGraphics canvas; void setup() { canvas = createGraphics(500, 500, P3D); scene = new Scene(this, canvas); // or use the equivalent (to the previous two lines) but simpler version: // scene = new Scene(this, P3D, 500, 500); }context()corresponds to thecanvas.Drawing functionality
There are several static drawing functions that complements those already provided by Processing, such as:drawCylinder(PGraphics, int, float, float),drawHollowCylinder(PGraphics, int, float, float, Vector, Vector),drawCone(PGraphics, int, float, float, float, float),drawCone(PGraphics, int, float, float, float, float, float)anddrawTorusSolenoid(PGraphics, int, int, float, float).Drawing functions that take a
PGraphicsparameter (including the above static ones), such asGraph.beginHUD(),Graph.endHUD(),drawAxes(PGraphics, float),drawCross(float, float, float)anddrawGrid(PGraphics)among others, can be used to set aNode.setShape(PShape)(see alsoNode.setShape(Consumer)).Another scene's eye (different than the graph
Graph.eye()) can be drawn withdrawFrustum(Graph). Typical usage include interactive minimaps and visibility culling visualization and debugging.Picking and interaction
Refer to theGraphdocumentation for details about how picking and interaction works in nub.The scene just provides additional methods to pick and interact with the mouse that wrap the
PApplet.pmouseXandPApplet.pmouseY,mouseDX(),mouseDY(),mouseRADX()andmouseRADY()variables and thus simplify the method signatures provide by theGraphcounterparts. See:tag(String)andtag()for node tagging;shift(Node, float)andshift(String, float)for translation;spin(Node, float)andspin(String, float)for spinning;lookAround(float)andcad(float)for eye look-around and rotate-cad, to name a few.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceScene.Callback-
Nested classes/interfaces inherited from class nub.core.Graph
Graph.Type, Graph.Visibility
-
-
Constructor Summary
Constructors Constructor Description Scene(PApplet pApplet)Same asthis(pApplet.g).Scene(PApplet pApplet, float radius)Same as {this(pApplet.g, new Vector(), radius)}.Scene(PApplet pApplet, Node eye)Same asthis(pApplet.g, eye).Scene(PApplet pApplet, Node eye, float radius)Same asthis(pApplet, eye, new Vector(), radius).Scene(PApplet pApplet, Node eye, Vector center, float radius)Same asthis(pApplet.g, eye, center, rdius).Scene(PApplet pApplet, Vector center, float radius)Same asthis(pApplet.g, center, radius).Scene(PGraphics pGraphics)Same asthis(pGraphics, new Vector(), 100).Scene(PGraphics pGraphics, float radius)Same asthis(pGraphics, new Vector(), radius).Scene(PGraphics pGraphics, Node eye)Same assuper(pGraphics, pGraphics.width, pGraphics.height, eye).Scene(PGraphics pGraphics, Node eye, float radius)Same asthis(pGraphics, eye, new Vector(), radius).Scene(PGraphics pGraphics, Node eye, Vector center, float radius)Same assuper(pGraphics, pGraphics.width, pGraphics.height, eye, type, center, radius), and then setsGraph.leftHandedtotrue.Scene(PGraphics pGraphics, Vector center, float radius)Same assuper(pGraphics, pGraphics.width, pGraphics.height, pGraphics instanceof PGraphics2D ? Type.TWO_D : Type.PERSPECTIVE, center, radius), and then setsGraph.leftHandedtotrue.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcad()Same assuper.rotateCAD(mouseRADX(), mouseRADY()).voidcad(float inertia)Same assuper.rotateCAD(mouseRADX(), mouseRADY(), new Vector(0, 1, 0), inertia).voidcad(Vector up)Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up).voidcad(Vector up, float inertia)Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up, inertia).PGraphicscontext()Returns the PGraphics instance this scene is related to.voiddisableDepthTest()Disables z-buffer oncontext().static voiddisableDepthTest(PGraphics pGraphics)Disables z-buffer onpGraphics.voiddisplay()Same asdisplay(null, false, false, null, null, 0, 0).voiddisplay(boolean axes)Same asdisplay(null, axes, null, null, null, 0, 0).voiddisplay(boolean axes, int x, int y)Same asdisplay(null, axes, null, null, null, x, y).voiddisplay(boolean axes, Integer grid)Same asdisplay(null, axes, grid, null, null, 0, 0).voiddisplay(boolean axes, Integer grid, int x, int y)Same asdisplay(null, axes, grid, null, null, x, y).voiddisplay(boolean axes, Integer grid, Node subtree)Same asdisplay(axes, grid, subtree, null, 0, 0).voiddisplay(boolean axes, Integer grid, Node subtree, int x, int y)Same asdisplay(null, axes, grid, subtree, null, x, y).voiddisplay(boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)Same asdisplay(null, axes, grid, subtree, worldCallback, 0, 0).voiddisplay(boolean axes, Integer grid, Scene.Callback worldCallback)Same asdisplay(null, axes, grid, null, worldCallback, 0, 0).voiddisplay(boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)Same asdisplay(background, axes, grid, null, worldCallback, x, y).voiddisplay(boolean axes, Node subtree)Same asdisplay(null, axes, null, subtree, null, 0, 0).voiddisplay(boolean axes, Node subtree, int x, int y)Same asdisplay(null, axes, null, subtree, null, x, y).voiddisplay(boolean axes, Node subtree, Scene.Callback worldCallback)Same asdisplay(null, axes, null, subtree, worldCallback, 0, 0).voiddisplay(boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)Same asdisplay(null, axes, subtree, worldCallback, cornerX, cornerY).voiddisplay(int x, int y)Same asdisplay(null, false, false, null, null, x, y).voiddisplay(Object background)Same asdisplay(background, false, false, null, null, 0, 0).voiddisplay(Object background, boolean axes)Same asdisplay(background, axes, null, null, null, 0, 0).voiddisplay(Object background, boolean axes, int x, int y)Same asdisplay(background, axes, null, null, null, x, y).voiddisplay(Object background, boolean axes, Integer grid)Same asdisplay(background, axes, grid, null, null, 0, 0).voiddisplay(Object background, boolean axes, Integer grid, int x, int y)Same asdisplay(background, axes, grid, null, null, x, y).voiddisplay(Object background, boolean axes, Integer grid, Node subtree)Same asdisplay(background, axes, grid, subtree, null, 0, 0).voiddisplay(Object background, boolean axes, Integer grid, Node subtree, int x, int y)Same asdisplay(background, axes, grid, subtree, null, x, y).voiddisplay(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)Same asdisplay(background, axes, grid, subtree, worldCallback, 0, 0).voiddisplay(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)Display the scene tree.voiddisplay(Object background, boolean axes, Integer grid, Scene.Callback worldCallback)Same asdisplay(background, axes, grid, null, worldCallback, 0, 0).voiddisplay(Object background, boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)Same asdisplay(background, axes, grid, null, worldCallback, x, y).voiddisplay(Object background, boolean axes, Node subtree)Same asdisplay(background, axes, null, subtree, null, 0, 0).voiddisplay(Object background, boolean axes, Node subtree, int x, int y)Same asdisplay(background, axes, null, subtree, null, x, y).voiddisplay(Object background, boolean axes, Node subtree, Scene.Callback worldCallback)Same asdisplay(background, axes, null, subtree, worldCallback, 0, 0).voiddisplay(Object background, boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)Same asdisplay(background, axes, null, subtree, worldCallback, cornerX, cornerY).voiddisplay(Object background, int x, int y)Same asdisplay(background, false, false, null, null, x, y).voiddisplay(Object background, Node subtree)Same asdisplay(background, false, null, subtree, null, 0, 0).voiddisplay(Object background, Node subtree, int x, int y)Same asdisplay(background, false, null, null, subtree, x, y).voiddisplay(Object background, Node subtree, Scene.Callback worldCallback)Same asdisplay(background, false, null, subtree, worldCallback, 0, 0).voiddisplay(Object background, Node subtree, Scene.Callback worldCallback, int x, int y)Same asdisplay(background, false, null, subtree, worldCallback, x, y).voiddisplay(Object background, Scene.Callback worldCallback)Same asdisplay(background, false, false, null, worldCallback, 0, 0).voiddisplay(Object background, Scene.Callback worldCallback, int x, int y)Same asdisplay(background, false, false, null, worldCallback, x, y).voiddisplay(Node subtree)Same asdisplay(null, false, null, subtree, null, 0, 0).voiddisplay(Node subtree, int x, int y)Same asdisplay(null, false, null, null, subtree, x, y).voiddisplay(Node subtree, Scene.Callback worldCallback)Same asdisplay(null, false, null, subtree, worldCallback, 0, 0).voiddisplay(Node subtree, Scene.Callback worldCallback, int x, int y)Same asdisplay(null, false, null, subtree, worldCallback, x, y).voiddisplay(Scene.Callback worldCallback)Same asdisplay(null, false, false, null, worldCallback, 0, 0).voiddisplay(Scene.Callback worldCallback, int x, int y)Same asdisplay(null, false, false, null, worldCallback, x, y).voiddisplayBackBuffer()Same asdisplayBackBuffer(0, 0).voiddisplayBackBuffer(int background)Same asdisplayBackBuffer(background, 0, 0).voiddisplayBackBuffer(int pixelX, int pixelY)Displays the buffer nub use for picking at the given pixel coordinates.voiddisplayBackBuffer(int background, int pixelX, int pixelY)Displays the buffer nub use for picking at the given pixel coordinates, withbackgroundcolor.voiddispose()Same assaveConfig().voiddrawArc(PGraphics pGraphics, float radius, float minAngle, float maxAngle, int detail)Draws an Arc ontopGraphicscentered at(0,0)on the XY PlaneminAngleandmaxAnglerepresents the Arc's width.voiddrawArrow(float length)Simply callsdrawArrow(length, 0.05f * length)voiddrawArrow(float length, float radius)Draws an arrow ofradiusandlengthalong the positive Z axis.voiddrawArrow(Vector vector)Same asdrawArrow(vector, 0.05f * vector.magnitude()).voiddrawArrow(Vector vector, float radius)Same asdrawArrow(new Vector(), vector, radius).voiddrawArrow(Vector from, Vector to, float radius)Draws an arrow ofradiusbetweenfromand the 3D pointto.voiddrawAxes()Convenience function that simply callsdrawAxes(radius()).voiddrawAxes(float length)Same asdrawAxes(context(), length, isLeftHanded()).voiddrawAxes(PGraphics pGraphics)Same asdrawAxes(pGraphics, radius(), isLeftHanded()).static voiddrawAxes(PGraphics pGraphics, float length)Draws axes oflengthontopGraphics.voiddrawCircledBullsEye(float x, float y)Same asdrawCircledBullsEye(x, y, radius() / 5).voiddrawCircledBullsEye(float x, float y, float diameter)voiddrawCone(float radius, float height)Same asdrawCone(12, 0, 0, radius, height)voiddrawCone(float radius1, float radius2, float height)Same asdrawCone(18, 0, 0, radius1, radius2, height).voiddrawCone(int detail, float radius, float height)Same asdrawCone(detail, 0, 0, radius, height)voiddrawCone(int detail, float radius1, float radius2, float height)Same asdrawCone(detail, 0, 0, radius1, radius2, height).voiddrawCone(int detail, float x, float y, float radius, float height)Same asdrawCone(context(), detail, x, y, radius, height).voiddrawCone(int detail, float x, float y, float radius1, float radius2, float height)Same asdrawCone(context(), detail, x, y, radius1, radius2, height).voiddrawCone(PGraphics pGraphics)Same asdrawCone(pGraphics, 12, 0, 0, radius()/4, sqrt(3) * radius()/4).static voiddrawCone(PGraphics pGraphics, float radius, float height)Same asdrawCone(pGraphics, 12, 0, 0, radius, height).static voiddrawCone(PGraphics pGraphics, float radius1, float radius2, float height)Same asdrawCone(pGraphics, 18, 0, 0, radius1, radius2, height).voiddrawCone(PGraphics pGraphics, float height, float a, float b, int detail)Draws a cone ontopGraphicscentered at(0,0)having Semi-axisaandbandheightdimensions.voiddrawCone(PGraphics pGraphics, float height, List<Vector> vertices)Draws a cone ontopGraphicscentered at(0,0)whereverticesrepresents a polygon on XY Plane and withheightas height.static voiddrawCone(PGraphics pGraphics, int detail, float radius, float height)Same asdrawCone(pGraphics, detail, 0, 0, radius, height).static voiddrawCone(PGraphics pGraphics, int detail, float radius1, float radius2, float height)Same asdrawCone(pGraphics, detail, 0, 0, radius1, radius2, height).static voiddrawCone(PGraphics pGraphics, int detail, float x, float y, float radius, float height)Draws a cone ontopGraphicscentered at(x,y)havingradiusandheightdimensions.static voiddrawCone(PGraphics pGraphics, int detail, float x, float y, float radius1, float radius2, float height)Draws a truncated cone ontopGraphicsalong the positivezaxis, with its base centered at(x,y),height, and radiiradius1andradius2(basis and height respectively).voiddrawCone(PGraphics pGraphics, List<Vector> vertices, float scale)Draws a cone ontopGraphicscentered at(0,0,0)whereverticesrepresents the base of the Polygon and withscaleas maximum height.voiddrawCross(float x, float y)Convenience function that simply callsdrawCross(x, y, radius()/5).voiddrawCross(float x, float y, float length)voiddrawCross(Node node)drawCross(float, float, float)centered at the projected node origin.voiddrawCross(Node node, float length)drawCross(float, float, float)centered at the projected node origin, havinglengthpixels.voiddrawCylinder(float radius, float height)Same asdrawCylinder(20, radius, height).voiddrawCylinder(int detail, float radius, float height)Same asdrawCylinder(context(), detail, radius, height).voiddrawCylinder(PGraphics pGraphics)Same asdrawCylinder(context, radius()/6, radius()/3).static voiddrawCylinder(PGraphics pGraphics, float radius, float height)Same asdrawCylinder(pGraphics, 20, radius, height).static voiddrawCylinder(PGraphics pGraphics, int detail, float radius, float height)Draws a cylinder ofradiusandheightontopGraphics.voiddrawDottedGrid()Convenience function that simply callsdrawDottedGrid(radius(), 10).voiddrawDottedGrid(float size)Convenience function that simply callsdrawDottedGrid(size, 10).voiddrawDottedGrid(float size, int subdivisions)Same asdrawDottedGrid(context(), size, subdivisions).voiddrawDottedGrid(int subdivisions)Convenience function that simplt callsdrawDottedGrid(radius(), subdivisions).voiddrawDottedGrid(PGraphics pGraphics)Same asdrawDottedGrid(pGraphics, radius(), 10).static voiddrawDottedGrid(PGraphics pGraphics, float size, int subdivisions)Draws a dotted-grid ofsizeontopGraphicsin the XY plane, centered on (0,0,0), havingsubdivisions.voiddrawFrustum(Graph graph)Applies thegraph.eye()transformation and then callsdrawFrustum(PGraphics, Graph)on the scenecontext().static voiddrawFrustum(PGraphics pGraphics, Graph graph)Draws a representation of the viewing frustum ontopGraphicsaccording tograph.eye()andgraph._type.static voiddrawFrustum(PGraphics pGraphics, PGraphics eyeBuffer, Node eye, Graph.Type type, float zNear, float zFar)Draws a representation of theeyeBufferfrustum ontopGraphicsaccording to frustum parameters:type, eyeNode.worldMagnitude(),zNearandzFar, while taking into account whether or not the scene isleftHanded.voiddrawGrid()Convenience function that simply callsdrawGrid(radius(), 10)voiddrawGrid(float size)Convenience function that simply callsdrawGrid(size, 10)voiddrawGrid(float size, int subdivisions)Same asdrawGrid(context(), size, subdivisions).voiddrawGrid(int subdivisions)Convenience function that simply callsdrawGrid(radius(), subdivisions)voiddrawGrid(PGraphics pGraphics)Same asdrawGrid(pGraphics, radius(), 10).static voiddrawGrid(PGraphics pGraphics, float size, int subdivisions)Draws a grid ofsizeontopGraphicsin the XY plane, centered on (0,0,0), havingsubdivisions.voiddrawHollowCylinder(float radius, float height, Vector normal1, Vector normal2)Same asdrawHollowCylinder(context(), radius, height, normal1, normal2).voiddrawHollowCylinder(int detail, float radius, float height, Vector normal1, Vector normal2)Same asdrawHollowCylinder(context(), detail, radius, height, normal1, normal2).static voiddrawHollowCylinder(PGraphics pGraphics, float radius, float height, Vector normal1, Vector normal2)Same asdrawHollowCylinder(pGraphics, 30, radius, height, normal1, normal2).static voiddrawHollowCylinder(PGraphics pGraphics, int detail, float radius, float height, Vector normal1, Vector normal2)Draws a hollow cylinder ontopGraphicswhose bases are formed by two cutting planes (normal1andnormal2), along the positivezaxis.voiddrawProjector(Graph eye, Vector point)Same asdrawProjectors(eye, Arrays.asList(point)).voiddrawProjectors(Graph graph, List<Vector> points)Draws the projection of each point inpointsin the near plane ontopGraphics.voiddrawSquaredBullsEye(float x, float y)Same asdrawSquaredBullsEye(x, y, radius() / 5).voiddrawSquaredBullsEye(float x, float y, float length)voiddrawTorusSolenoid()Convenience function that simply callsdrawTorusSolenoid(6).voiddrawTorusSolenoid(float insideRadius)Convenience function that simply callsdrawTorusSolenoid(6, insideRadius).voiddrawTorusSolenoid(int faces)Convenience function that simply callsdrawTorusSolenoid(faces, 0.07f * radius()).voiddrawTorusSolenoid(int faces, float insideRadius)Convenience function that simply callsdrawTorusSolenoid(faces, 100, insideRadius, insideRadius * 1.3f).voiddrawTorusSolenoid(int faces, int detail, float insideRadius, float outsideRadius)Same asdrawTorusSolenoid(context(), faces, detail, insideRadius, outsideRadius).static voiddrawTorusSolenoid(PGraphics pGraphics)Same asdrawTorusSolenoid(pGraphics, 6).static voiddrawTorusSolenoid(PGraphics pGraphics, float insideRadius)Same asdrawTorusSolenoid(pGraphics, 6, insideRadius).static voiddrawTorusSolenoid(PGraphics pGraphics, int faces, float insideRadius)Same asdrawTorusSolenoid(pGraphics, faces, 100, insideRadius, insideRadius * 1.3f).static voiddrawTorusSolenoid(PGraphics pGraphics, int faces, int detail, float insideRadius, float outsideRadius)Draws a torus solenoid ontopGraphics.voidenableDepthTest()Enables z-buffer oncontext().static voidenableDepthTest(PGraphics pGraphics)Enables z-buffer onpGraphics.booleanhasFocus()Same asreturn hasFocus(pApplet.mouseX, pApplet.mouseY).voidimage()Same asimage(0, 0).voidimage(int pixelX, int pixelY)Similar topAppletimage().voidline(float x1, float y1, float x2, float y2)Same ascontext().line(x1, y1, x2, y2).voidline(float x1, float y1, float z1, float x2, float y2, float z2)Same asif (this.is2D()) line(context(), x1, y1, x2, y2); else line(context(), x1, y1, z1, x2, y2, z2);.static voidline(PGraphics pGraphics, float x1, float y1, float x2, float y2)Wrapper for PGraphics.line(x1, y1, x2, y2).static voidline(PGraphics pGraphics, float x1, float y1, float z1, float x2, float y2, float z2)Wrapper for PGraphics.line(x1, y1, z1, x2, y2, z2).voidloadConfig()Same asloadConfig("data/config.json").voidloadConfig(String fileName)Vectorlocation()Same asreturn location(mouseX(), mouseY()).Vectorlocation(int pixelX, int pixelY)Returns the world coordinates of the 3D point located at(pixelX, pixelY)on screen.voidlookAround()Same assuper.lookAround(mouseRADX(), mouseRADY()).voidlookAround(float inertia)Same assuper.lookAround(mouseRADX(), mouseRADY(), inertia).floatmouseDX()Returns the last horizontal mouse displacement.floatmouseDY()Returns the last vertical mouse displacement.floatmouseRADX()Same asreturn mouseRADX(PI / width()).floatmouseRADX(float sensitivity)ConvertsmouseDX()into angular displacement (in radians) according tosensitivityand returns it.floatmouseRADY()Same asreturn mouseRADY(PI / height()).floatmouseRADY(float sensitivity)ConvertsmouseDY()into angular displacement (in radians) according tosensitivityand returns it.floatmouseSpeed()Returns the mouse speed expressed in pixels per milliseconds.intmouseX()Returns the current mouse x coordinate.intmouseY()Returns the current mouse y coordinate.floatpixelDepth()Same asreturn pixelDepth(mouseX(), mouseY()).floatpixelDepth(int pixelX, int pixelY)Returns the depth (z-value) of the object under thepixel.voidpixelToLine(Vector origin, Vector direction)Same aspixelToLine(mouseX(), mouseY(), origin, direction).intpmouseX()Returns the previous mouse x coordinate.intpmouseY()Returns the previous mouse y coordinate.voidsaveConfig()Same assaveConfig("data/config.json").voidsaveConfig(String fileName)booleansetCenter()Same asreturn setCenter(mouseX(), mouseY()).booleansetCenter(int pixelX, int pixelY)TheGraph.center()is set to the point located underpixelon screen.booleansetCenterFromPixel(int pixelX, int pixelY)TheGraph.center()is set to the point located underpixelon screen.static voidsetUniform(PShader shader, String name, Matrix matrix)Sets thenameshaderuniform frommatrix.static voidsetUniform(PShader shader, String name, Vector vector)Sets thenameshaderuniform fromvector.voidshift()Same asshift(Graph.inertia).voidshift(float inertia)Same asshift((String)null, inertia).voidshift(String tag)Same asshift(tag, Graph.inertia).voidshift(String tag, float inertia)Same asif (tag == null || node(tag) != null) shift(node(tag), inertia).voidshift(Node node)Same as .voidshift(Node node, float lag)Same assuper.shift(node, mouseDX() * (1 - lag), mouseDY() * (1 - lag), 0, lag).voidspin()Same asspin((String)null).voidspin(float inertia)Same asspin((String)null, inertia).voidspin(String tag)Same asspin(tag, Graph.inertia).voidspin(String tag, float inertia)Same asif (tag == null || node(tag) != null) spin(node(tag), inertia).voidspin(Node node)Same asspin(node, Graph.inertia).voidspin(Node node, float inertia)Same assuper.spinNode(node, pmouseX(), pmouseY(), mouseX(), mouseY(), inertia).voidtag()Same assuper.tag(mouseX(), mouseY()).voidtag(String tag)Same assuper.tag(tag, mouseX(), mouseY()).static MatrixtoMatrix(PMatrix2D pMatrix2D)Converts a PMatrix2D to aMatrix.static MatrixtoMatrix(PMatrix3D pMatrix3D)Converts a PMatrix3D to aMatrix.static PMatrix3DtoPMatrix(Matrix matrix)Converts aMatrixto a PMatrix3D.static PMatrix2DtoPMatrix2D(Matrix matrix)Converts aMatrixto a PMatrix2D.static PVectortoPVector(Vector vector)Converts aVectorto a PVector.static VectortoVector(PVector pVector)Converts a PVector to aVector.booleantracks(Node node)Same asreturn super.tracks(node, mouseX(), mouseY()).NodeupdateTag()Same asreturn super.updateTag(mouseX(), mouseY()).NodeupdateTag(String tag)Same asreturn updateTag(null, tag).NodeupdateTag(String tag, List<Node> nodeList)Same asreturn super.track(mouse(), nodeList).NodeupdateTag(String tag, Node[] nodes)Same asreturn super.updateTag(tag, mouseX(), mouseY(), nodes).NodeupdateTag(List<Node> nodeList)Same asreturn super.updateTag(mouseX(), mouseY(), nodeList).NodeupdateTag(Node subtree)Same asreturn updateTag(subtree, null).NodeupdateTag(Node[] nodeArray)Same asreturn super.track(mouse(), nodeArray).NodeupdateTag(Node subtree, String tag)Same asreturn super.updateTag(subtree, tag, mouseX(), mouseY()).voidvertex(float[] v)Same asvertex(context(), v).voidvertex(float x, float y)Same asvertex(context(), x, y).voidvertex(float x, float y, float z)Same asif (this.is2D()) vertex(context(), x, y); else vertex(context(), x, y, z).voidvertex(float x, float y, float u, float v)Same asvertex(context(), x, y, u, v).voidvertex(float x, float y, float z, float u, float v)Same asif (this.is2D()) vertex(context(), x, y, u, v); else vertex(context(), x, y, z, u, v);.static voidvertex(PGraphics pGraphics, float[] v)Wrapper for PGraphics.vertex(v)static voidvertex(PGraphics pGraphics, float x, float y)Wrapper for PGraphics.vertex(x,y)static voidvertex(PGraphics pGraphics, float x, float y, float z)Wrapper for PGraphics.vertex(x,y,z)static voidvertex(PGraphics pGraphics, float x, float y, float u, float v)Wrapper for PGraphics.vertex(x,y,u,v)static voidvertex(PGraphics pGraphics, float x, float y, float z, float u, float v)Wrapper for PGraphics.vertex(x,y,z,u,v)-
Methods inherited from class nub.core.Graph
addBehavior, addBehavior, align, align, align, aspectRatio, at, ballVisibility, ballZFar, ballZNear, beginHUD, bounds, boxVisibility, branch, cad, cad, cad, castToFloat, castToInt, center, clearTags, clearTree, closeContext, disableTagging, displacement, displacement, distanceToBound, draw, endHUD, eye, fit, fit, fit, fit, fit, fit, fit, fit, fitFOV, fitFOV, focus, focus, focus, fov, hasFocus, hasTag, hasTag, height, hfov, interact, interact, interact, is2D, is3D, isConeBackFacing, isConeBackFacing, isConeBackFacing, isConeFrontFacing, isConeFrontFacing, isConeFrontFacing, isEye, isFaceBackFacing, isFaceBackFacing, isFaceFrontFacing, isFaceFrontFacing, isNumInstance, isOffscreen, isPointVisible, isPointVisible, isTagged, isTagValid, isTagValid, lastUpdate, location, location, lookAround, lookAround, lookAt, moveForward, moveForward, ndcToScreenDisplacement, ndcToScreenLocation, node, node, nodes, openContext, pixelToLine, pixelToSceneRatio, pre, projection, projectionView, projectionViewInverse, radius, randomize, randomNode, removeTag, removeTag, render, render, resetBehavior, rightVector, sceneToPixelRatio, screenDisplacement, screenDisplacement, screenLocation, screenLocation, screenLocation, screenToNDCDisplacement, screenToNDCLocation, setBoundingBall, setCenter, setEye, setFOV, setHeight, setHFOV, setRadius, setType, setUpVector, setUpVector, setViewDirection, setWidth, setZFar, setZNear, shift, shift, shift, shift, shift, shift, spin, spin, spin, spin, spin, spin, tag, tag, tag, tag, togglePerspective, tracks, turn, turn, turn, turn, turn, turn, type, untag, updateTag, updateTag, updateTag, updateTag, updateTag, updateTag, updateTag, updateTag, upVector, view, viewDirection, width, zFar, zFarSupplier, zNear, zNearSupplier, zoom, zoom, zoom, zoom, zoom, zoom
-
-
-
-
Constructor Detail
-
Scene
public Scene(PApplet pApplet, Node eye)
Same asthis(pApplet.g, eye).- See Also:
Scene(PGraphics, Node)
-
Scene
public Scene(PGraphics pGraphics, Node eye)
Same assuper(pGraphics, pGraphics.width, pGraphics.height, eye).
-
Scene
public Scene(PApplet pApplet)
Same asthis(pApplet.g).- See Also:
Scene(PGraphics)
-
Scene
public Scene(PGraphics pGraphics)
Same asthis(pGraphics, new Vector(), 100).- See Also:
Scene(PApplet, Vector, float)
-
Scene
public Scene(PApplet pApplet, float radius)
Same as {this(pApplet.g, new Vector(), radius)}.- See Also:
Scene(PGraphics, Vector, float)
-
Scene
public Scene(PApplet pApplet, Vector center, float radius)
Same asthis(pApplet.g, center, radius).- See Also:
Scene(PGraphics, Vector, float)
-
Scene
public Scene(PGraphics pGraphics, float radius)
Same asthis(pGraphics, new Vector(), radius).- See Also:
Scene(PGraphics, Vector, float)
-
Scene
public Scene(PGraphics pGraphics, Vector center, float radius)
Same assuper(pGraphics, pGraphics.width, pGraphics.height, pGraphics instanceof PGraphics2D ? Type.TWO_D : Type.PERSPECTIVE, center, radius), and then setsGraph.leftHandedtotrue.
-
Scene
public Scene(PApplet pApplet, Node eye, float radius)
Same asthis(pApplet, eye, new Vector(), radius).- See Also:
Scene(PApplet, Node, Vector, float)
-
Scene
public Scene(PApplet pApplet, Node eye, Vector center, float radius)
Same asthis(pApplet.g, eye, center, rdius).- See Also:
Scene(PGraphics, Node, Vector, float)
-
Scene
public Scene(PGraphics pGraphics, Node eye, float radius)
Same asthis(pGraphics, eye, new Vector(), radius).- See Also:
Scene(PGraphics, Node, Vector, float)
-
Scene
public Scene(PGraphics pGraphics, Node eye, Vector center, float radius)
Same assuper(pGraphics, pGraphics.width, pGraphics.height, eye, type, center, radius), and then setsGraph.leftHandedtotrue.
-
-
Method Detail
-
context
public PGraphics context()
Returns the PGraphics instance this scene is related to. It may be the PApplet's, if the scene is on-screen or an user-defined one if the sceneGraph.isOffscreen().
-
setUniform
public static void setUniform(PShader shader, String name, Matrix matrix)
Sets thenameshaderuniform frommatrix.
-
setUniform
public static void setUniform(PShader shader, String name, Vector vector)
Sets thenameshaderuniform fromvector.
-
pixelToLine
public void pixelToLine(Vector origin, Vector direction)
Same aspixelToLine(mouseX(), mouseY(), origin, direction).
-
setCenter
public boolean setCenter()
Same asreturn setCenter(mouseX(), mouseY()).- See Also:
mouseX(),mouseY(),setCenter(int, int)
-
setCenter
public boolean setCenter(int pixelX, int pixelY)TheGraph.center()is set to the point located underpixelon screen.2D windows always returns true.
3D Cameras returns
trueif a point was found underpixelandfalseif none was found (in this case noGraph.center()is set).
-
pixelDepth
public float pixelDepth()
Same asreturn pixelDepth(mouseX(), mouseY()).- See Also:
mouseX(),mouseY(),pixelDepth(int, int)
-
pixelDepth
public float pixelDepth(int pixelX, int pixelY)Returns the depth (z-value) of the object under thepixel. Used bylocation(int, int).The z-value ranges in [0..1] (near and far plane respectively). In 3D note that this value is not a linear interpolation between
Graph.zNear()andGraph.zFar():z = zFar() / (zFar() - zNear()) * (1.0f - zNear() / z')wherez'is the distance from the point you project to the eye, along theGraph.viewDirection().- See Also:
location(int, int)
-
location
public Vector location()
Same asreturn location(mouseX(), mouseY()).- See Also:
mouseX(),mouseY(),location(int, int)
-
location
public Vector location(int pixelX, int pixelY)
Returns the world coordinates of the 3D point located at(pixelX, pixelY)on screen. May be null if no object is under pixel.
-
disableDepthTest
public void disableDepthTest()
Disables z-buffer oncontext().
-
enableDepthTest
public void enableDepthTest()
Enables z-buffer oncontext().
-
disableDepthTest
public static void disableDepthTest(PGraphics pGraphics)
Disables z-buffer onpGraphics.
-
enableDepthTest
public static void enableDepthTest(PGraphics pGraphics)
Enables z-buffer onpGraphics.
-
setCenterFromPixel
public boolean setCenterFromPixel(int pixelX, int pixelY)TheGraph.center()is set to the point located underpixelon screen.Returns
trueif a point was found underpixelandfalseif none was found (in this case noGraph.center()is set).
-
display
public void display()
Same asdisplay(null, false, false, null, null, 0, 0).
-
display
public void display(Object background)
Same asdisplay(background, false, false, null, null, 0, 0).
-
display
public void display(int x, int y)Same asdisplay(null, false, false, null, null, x, y).
-
display
public void display(Object background, int x, int y)
Same asdisplay(background, false, false, null, null, x, y).
-
display
public void display(Scene.Callback worldCallback)
Same asdisplay(null, false, false, null, worldCallback, 0, 0).
-
display
public void display(Object background, Scene.Callback worldCallback)
Same asdisplay(background, false, false, null, worldCallback, 0, 0).
-
display
public void display(Scene.Callback worldCallback, int x, int y)
Same asdisplay(null, false, false, null, worldCallback, x, y).
-
display
public void display(Object background, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, false, false, null, worldCallback, x, y).
-
display
public void display(boolean axes, Integer grid, Scene.Callback worldCallback)Same asdisplay(null, axes, grid, null, worldCallback, 0, 0).
-
display
public void display(Object background, boolean axes, Integer grid, Scene.Callback worldCallback)
Same asdisplay(background, axes, grid, null, worldCallback, 0, 0).
-
display
public void display(boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)Same asdisplay(background, axes, grid, null, worldCallback, x, y).
-
display
public void display(Object background, boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, axes, grid, null, worldCallback, x, y).
-
display
public void display(Node subtree)
Same asdisplay(null, false, null, subtree, null, 0, 0).
-
display
public void display(Object background, Node subtree)
Same asdisplay(background, false, null, subtree, null, 0, 0).
-
display
public void display(Node subtree, int x, int y)
Same asdisplay(null, false, null, null, subtree, x, y).
-
display
public void display(Object background, Node subtree, int x, int y)
Same asdisplay(background, false, null, null, subtree, x, y).
-
display
public void display(boolean axes, Node subtree)Same asdisplay(null, axes, null, subtree, null, 0, 0).
-
display
public void display(Object background, boolean axes, Node subtree)
Same asdisplay(background, axes, null, subtree, null, 0, 0).
-
display
public void display(boolean axes, Integer grid, Node subtree)Same asdisplay(axes, grid, subtree, null, 0, 0).
-
display
public void display(Object background, boolean axes, Integer grid, Node subtree)
Same asdisplay(background, axes, grid, subtree, null, 0, 0).
-
display
public void display(boolean axes, Node subtree, int x, int y)Same asdisplay(null, axes, null, subtree, null, x, y).
-
display
public void display(Object background, boolean axes, Node subtree, int x, int y)
Same asdisplay(background, axes, null, subtree, null, x, y).
-
display
public void display(boolean axes, Integer grid, Node subtree, int x, int y)Same asdisplay(null, axes, grid, subtree, null, x, y).
-
display
public void display(Object background, boolean axes, Integer grid, Node subtree, int x, int y)
Same asdisplay(background, axes, grid, subtree, null, x, y).
-
display
public void display(Node subtree, Scene.Callback worldCallback)
Same asdisplay(null, false, null, subtree, worldCallback, 0, 0).
-
display
public void display(Object background, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, false, null, subtree, worldCallback, 0, 0).
-
display
public void display(Node subtree, Scene.Callback worldCallback, int x, int y)
Same asdisplay(null, false, null, subtree, worldCallback, x, y).
-
display
public void display(Object background, Node subtree, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, false, null, subtree, worldCallback, x, y).
-
display
public void display(boolean axes)
Same asdisplay(null, axes, null, null, null, 0, 0).
-
display
public void display(Object background, boolean axes)
Same asdisplay(background, axes, null, null, null, 0, 0).
-
display
public void display(boolean axes, Integer grid)Same asdisplay(null, axes, grid, null, null, 0, 0).
-
display
public void display(Object background, boolean axes, Integer grid)
Same asdisplay(background, axes, grid, null, null, 0, 0).
-
display
public void display(boolean axes, int x, int y)Same asdisplay(null, axes, null, null, null, x, y).
-
display
public void display(Object background, boolean axes, int x, int y)
Same asdisplay(background, axes, null, null, null, x, y).
-
display
public void display(boolean axes, Integer grid, int x, int y)Same asdisplay(null, axes, grid, null, null, x, y).
-
display
public void display(Object background, boolean axes, Integer grid, int x, int y)
Same asdisplay(background, axes, grid, null, null, x, y).
-
display
public void display(boolean axes, Node subtree, Scene.Callback worldCallback)Same asdisplay(null, axes, null, subtree, worldCallback, 0, 0).
-
display
public void display(Object background, boolean axes, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, axes, null, subtree, worldCallback, 0, 0).
-
display
public void display(boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)Same asdisplay(null, axes, grid, subtree, worldCallback, 0, 0).
-
display
public void display(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, axes, grid, subtree, worldCallback, 0, 0).
-
display
public void display(boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)Same asdisplay(null, axes, subtree, worldCallback, cornerX, cornerY).
-
display
public void display(Object background, boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)
Same asdisplay(background, axes, null, subtree, worldCallback, cornerX, cornerY).
-
display
public void display(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)
Display the scene tree.- Parameters:
background- color or image; may be null (don't refresh)axes-grid- color; may be null (no grid)subtree-worldCallback-cornerX-cornerY-
-
image
public void image()
Same asimage(0, 0).- See Also:
image(int, int)
-
image
public void image(int pixelX, int pixelY)Similar topAppletimage(). Used to display the offscreen scenecontext(). Does nothing if the scene is on-screen. Throws an error if there's an onscreen scene and this method is called withinGraph.openContext()andGraph.closeContext().Call this method, instead of
pAppletimage(), to makehasFocus()work always properly.
-
displayBackBuffer
public void displayBackBuffer()
Same asdisplayBackBuffer(0, 0).- See Also:
displayBackBuffer(int, int, int)
-
displayBackBuffer
public void displayBackBuffer(int background)
Same asdisplayBackBuffer(background, 0, 0).- See Also:
displayBackBuffer(int, int, int)
-
displayBackBuffer
public void displayBackBuffer(int pixelX, int pixelY)Displays the buffer nub use for picking at the given pixel coordinates. Used for debugging.- See Also:
displayBackBuffer(int, int, int)
-
displayBackBuffer
public void displayBackBuffer(int background, int pixelX, int pixelY)Displays the buffer nub use for picking at the given pixel coordinates, withbackgroundcolor. Used for debugging.
-
dispose
public void dispose()
Same assaveConfig().Should be called automatically by P5, but it is currently broken. See: https://github.com/processing/processing/issues/4445
- See Also:
saveConfig(),saveConfig(String),loadConfig(),loadConfig(String)
-
saveConfig
public void saveConfig()
Same assaveConfig("data/config.json").Note that off-screen scenes require
saveConfig(String)instead.- See Also:
saveConfig(String),loadConfig(),loadConfig(String)
-
saveConfig
public void saveConfig(String fileName)
- See Also:
saveConfig(),loadConfig(),loadConfig(String)
-
loadConfig
public void loadConfig()
Same asloadConfig("data/config.json").Note that off-screen scenes require
loadConfig(String)instead.- See Also:
loadConfig(String),saveConfig(),saveConfig(String)
-
loadConfig
public void loadConfig(String fileName)
- See Also:
saveConfig(),saveConfig(String),loadConfig()
-
vertex
public void vertex(float[] v)
Same asvertex(context(), v).- See Also:
vertex(PGraphics, float[])
-
vertex
public static void vertex(PGraphics pGraphics, float[] v)
Wrapper for PGraphics.vertex(v)
-
vertex
public void vertex(float x, float y, float z)Same asif (this.is2D()) vertex(context(), x, y); else vertex(context(), x, y, z).- See Also:
vertex(PGraphics, float, float, float)
-
vertex
public static void vertex(PGraphics pGraphics, float x, float y, float z)
Wrapper for PGraphics.vertex(x,y,z)
-
vertex
public void vertex(float x, float y, float z, float u, float v)Same asif (this.is2D()) vertex(context(), x, y, u, v); else vertex(context(), x, y, z, u, v);.
-
vertex
public static void vertex(PGraphics pGraphics, float x, float y, float z, float u, float v)
Wrapper for PGraphics.vertex(x,y,z,u,v)
-
vertex
public void vertex(float x, float y)Same asvertex(context(), x, y).- See Also:
vertex(PGraphics, float, float)
-
vertex
public static void vertex(PGraphics pGraphics, float x, float y)
Wrapper for PGraphics.vertex(x,y)
-
vertex
public void vertex(float x, float y, float u, float v)Same asvertex(context(), x, y, u, v).
-
vertex
public static void vertex(PGraphics pGraphics, float x, float y, float u, float v)
Wrapper for PGraphics.vertex(x,y,u,v)
-
line
public void line(float x1, float y1, float z1, float x2, float y2, float z2)Same asif (this.is2D()) line(context(), x1, y1, x2, y2); else line(context(), x1, y1, z1, x2, y2, z2);.
-
line
public static void line(PGraphics pGraphics, float x1, float y1, float z1, float x2, float y2, float z2)
Wrapper for PGraphics.line(x1, y1, z1, x2, y2, z2).
-
line
public void line(float x1, float y1, float x2, float y2)Same ascontext().line(x1, y1, x2, y2).
-
line
public static void line(PGraphics pGraphics, float x1, float y1, float x2, float y2)
Wrapper for PGraphics.line(x1, y1, x2, y2).
-
drawArrow
public void drawArrow(float length)
Simply callsdrawArrow(length, 0.05f * length)- See Also:
drawArrow(float, float)
-
drawArrow
public void drawArrow(float length, float radius)Draws an arrow ofradiusandlengthalong the positive Z axis.Use
drawArrow(Vector, Vector, float)to place the arrow in 3D.
-
drawArrow
public void drawArrow(Vector vector)
Same asdrawArrow(vector, 0.05f * vector.magnitude()).- See Also:
drawArrow(Vector, float)
-
drawArrow
public void drawArrow(Vector vector, float radius)
Same asdrawArrow(new Vector(), vector, radius).- See Also:
drawArrow(Vector, Vector, float)
-
drawArrow
public void drawArrow(Vector from, Vector to, float radius)
Draws an arrow ofradiusbetweenfromand the 3D pointto.- See Also:
drawArrow(float, float)
-
drawCylinder
public void drawCylinder(float radius, float height)Same asdrawCylinder(20, radius, height).- See Also:
drawCylinder(int, float, float)
-
drawCylinder
public void drawCylinder(int detail, float radius, float height)Same asdrawCylinder(context(), detail, radius, height).
-
drawCylinder
public void drawCylinder(PGraphics pGraphics)
Same asdrawCylinder(context, radius()/6, radius()/3).- See Also:
drawCylinder(PGraphics, float, float)
-
drawCylinder
public static void drawCylinder(PGraphics pGraphics, float radius, float height)
Same asdrawCylinder(pGraphics, 20, radius, height).
-
drawCylinder
public static void drawCylinder(PGraphics pGraphics, int detail, float radius, float height)
Draws a cylinder ofradiusandheightontopGraphics.
-
drawHollowCylinder
public void drawHollowCylinder(float radius, float height, Vector normal1, Vector normal2)Same asdrawHollowCylinder(context(), radius, height, normal1, normal2).
-
drawHollowCylinder
public void drawHollowCylinder(int detail, float radius, float height, Vector normal1, Vector normal2)Same asdrawHollowCylinder(context(), detail, radius, height, normal1, normal2).
-
drawHollowCylinder
public static void drawHollowCylinder(PGraphics pGraphics, float radius, float height, Vector normal1, Vector normal2)
Same asdrawHollowCylinder(pGraphics, 30, radius, height, normal1, normal2).
-
drawHollowCylinder
public static void drawHollowCylinder(PGraphics pGraphics, int detail, float radius, float height, Vector normal1, Vector normal2)
Draws a hollow cylinder ontopGraphicswhose bases are formed by two cutting planes (normal1andnormal2), along the positivezaxis.- Parameters:
detail-radius- radius of the hollow cylinderheight- height of the hollow cylindernormal1- normal of the plane that intersects the cylinder at z=0normal2- normal of the plane that intersects the cylinder at z=height- See Also:
drawCylinder(float, float)
-
drawCone
public void drawCone(int detail, float radius, float height)Same asdrawCone(detail, 0, 0, radius, height)
-
drawCone
public void drawCone(float radius, float height)Same asdrawCone(12, 0, 0, radius, height)
-
drawCone
public void drawCone(int detail, float x, float y, float radius, float height)Same asdrawCone(context(), detail, x, y, radius, height).
-
drawCone
public static void drawCone(PGraphics pGraphics, int detail, float radius, float height)
Same asdrawCone(pGraphics, detail, 0, 0, radius, height).
-
drawCone
public static void drawCone(PGraphics pGraphics, float radius, float height)
Same asdrawCone(pGraphics, 12, 0, 0, radius, height).
-
drawCone
public void drawCone(PGraphics pGraphics)
Same asdrawCone(pGraphics, 12, 0, 0, radius()/4, sqrt(3) * radius()/4).
-
drawCone
public static void drawCone(PGraphics pGraphics, int detail, float x, float y, float radius, float height)
Draws a cone ontopGraphicscentered at(x,y)havingradiusandheightdimensions.
-
drawCone
public void drawCone(int detail, float radius1, float radius2, float height)Same asdrawCone(detail, 0, 0, radius1, radius2, height).
-
drawCone
public void drawCone(float radius1, float radius2, float height)Same asdrawCone(18, 0, 0, radius1, radius2, height).
-
drawCone
public static void drawCone(PGraphics pGraphics, int detail, float radius1, float radius2, float height)
Same asdrawCone(pGraphics, detail, 0, 0, radius1, radius2, height).
-
drawCone
public static void drawCone(PGraphics pGraphics, float radius1, float radius2, float height)
Same asdrawCone(pGraphics, 18, 0, 0, radius1, radius2, height).
-
drawCone
public void drawCone(int detail, float x, float y, float radius1, float radius2, float height)Same asdrawCone(context(), detail, x, y, radius1, radius2, height).
-
drawCone
public static void drawCone(PGraphics pGraphics, int detail, float x, float y, float radius1, float radius2, float height)
Draws a truncated cone ontopGraphicsalong the positivezaxis, with its base centered at(x,y),height, and radiiradius1andradius2(basis and height respectively).
-
drawAxes
public void drawAxes()
Convenience function that simply callsdrawAxes(radius()).- See Also:
drawAxes(float)
-
drawAxes
public void drawAxes(float length)
Same asdrawAxes(context(), length, isLeftHanded()).- See Also:
drawAxes(PGraphics, float)
-
drawAxes
public void drawAxes(PGraphics pGraphics)
Same asdrawAxes(pGraphics, radius(), isLeftHanded()).- See Also:
drawAxes(PGraphics, float)
-
drawAxes
public static void drawAxes(PGraphics pGraphics, float length)
Draws axes oflengthontopGraphics.
-
drawGrid
public void drawGrid()
Convenience function that simply callsdrawGrid(radius(), 10)- See Also:
drawGrid(float, int)
-
drawGrid
public void drawGrid(float size)
Convenience function that simply callsdrawGrid(size, 10)- See Also:
drawGrid(float, int)
-
drawGrid
public void drawGrid(int subdivisions)
Convenience function that simply callsdrawGrid(radius(), subdivisions)- See Also:
drawGrid(float, int)
-
drawGrid
public void drawGrid(float size, int subdivisions)Same asdrawGrid(context(), size, subdivisions).- See Also:
drawGrid(PGraphics, float, int),drawAxes(float)
-
drawGrid
public void drawGrid(PGraphics pGraphics)
Same asdrawGrid(pGraphics, radius(), 10).- See Also:
drawGrid(PGraphics, float, int),drawAxes(float)
-
drawGrid
public static void drawGrid(PGraphics pGraphics, float size, int subdivisions)
Draws a grid ofsizeontopGraphicsin the XY plane, centered on (0,0,0), havingsubdivisions.
-
drawDottedGrid
public void drawDottedGrid()
Convenience function that simply callsdrawDottedGrid(radius(), 10).- See Also:
drawDottedGrid(float, int)
-
drawDottedGrid
public void drawDottedGrid(float size)
Convenience function that simply callsdrawDottedGrid(size, 10).- See Also:
drawDottedGrid(float, int)
-
drawDottedGrid
public void drawDottedGrid(int subdivisions)
Convenience function that simplt callsdrawDottedGrid(radius(), subdivisions).- See Also:
drawDottedGrid(float, int)
-
drawDottedGrid
public void drawDottedGrid(float size, int subdivisions)Same asdrawDottedGrid(context(), size, subdivisions).- See Also:
drawDottedGrid(PGraphics, float, int)
-
drawDottedGrid
public void drawDottedGrid(PGraphics pGraphics)
Same asdrawDottedGrid(pGraphics, radius(), 10).- See Also:
drawDottedGrid(PGraphics, float, int)
-
drawDottedGrid
public static void drawDottedGrid(PGraphics pGraphics, float size, int subdivisions)
Draws a dotted-grid ofsizeontopGraphicsin the XY plane, centered on (0,0,0), havingsubdivisions.
-
drawFrustum
public void drawFrustum(Graph graph)
Applies thegraph.eye()transformation and then callsdrawFrustum(PGraphics, Graph)on the scenecontext().
-
drawFrustum
public static void drawFrustum(PGraphics pGraphics, Graph graph)
Draws a representation of the viewing frustum ontopGraphicsaccording tograph.eye()andgraph._type.Note that if
pGraphics == graph.context()this method has not effect at all.
-
drawFrustum
public static void drawFrustum(PGraphics pGraphics, PGraphics eyeBuffer, Node eye, Graph.Type type, float zNear, float zFar)
Draws a representation of theeyeBufferfrustum ontopGraphicsaccording to frustum parameters:type, eyeNode.worldMagnitude(),zNearandzFar, while taking into account whether or not the scene isleftHanded.
-
drawProjector
public void drawProjector(Graph eye, Vector point)
Same asdrawProjectors(eye, Arrays.asList(point)).- See Also:
drawProjectors(Graph, List)
-
drawProjectors
public void drawProjectors(Graph graph, List<Vector> points)
Draws the projection of each point inpointsin the near plane ontopGraphics.This method should be used in conjunction with
drawFrustum(PGraphics, Graph).Note that if
graph == thisthis method has not effect at all.- See Also:
drawProjector(Graph, Vector)
-
drawCross
public void drawCross(Node node)
drawCross(float, float, float)centered at the projected node origin. If node is a Node instance the length of the cross is the nodeNode.bullsEyeSize(), otherwise it'sGraph.radius()/ 5. If node a Node instance and it isGraph.hasTag(Node)it also applies a stroke highlight.
-
drawCross
public void drawCross(Node node, float length)
drawCross(float, float, float)centered at the projected node origin, havinglengthpixels.- See Also:
drawCross(float, float, float)
-
drawCross
public void drawCross(float x, float y)Convenience function that simply callsdrawCross(x, y, radius()/5).- See Also:
drawCross(float, float, float)
-
drawCross
public void drawCross(float x, float y, float length)
-
drawSquaredBullsEye
public void drawSquaredBullsEye(float x, float y)Same asdrawSquaredBullsEye(x, y, radius() / 5).
-
drawSquaredBullsEye
public void drawSquaredBullsEye(float x, float y, float length)
-
drawCircledBullsEye
public void drawCircledBullsEye(float x, float y)Same asdrawCircledBullsEye(x, y, radius() / 5).
-
drawCircledBullsEye
public void drawCircledBullsEye(float x, float y, float diameter)- See Also:
drawSquaredBullsEye(float, float, float)
-
drawTorusSolenoid
public void drawTorusSolenoid()
Convenience function that simply callsdrawTorusSolenoid(6).- See Also:
drawTorusSolenoid(int)
-
drawTorusSolenoid
public void drawTorusSolenoid(int faces)
Convenience function that simply callsdrawTorusSolenoid(faces, 0.07f * radius()).- See Also:
drawTorusSolenoid(int, float)
-
drawTorusSolenoid
public void drawTorusSolenoid(float insideRadius)
Convenience function that simply callsdrawTorusSolenoid(6, insideRadius).- See Also:
drawTorusSolenoid(int, float)
-
drawTorusSolenoid
public void drawTorusSolenoid(int faces, float insideRadius)Convenience function that simply callsdrawTorusSolenoid(faces, 100, insideRadius, insideRadius * 1.3f).
-
drawTorusSolenoid
public void drawTorusSolenoid(int faces, int detail, float insideRadius, float outsideRadius)Same asdrawTorusSolenoid(context(), faces, detail, insideRadius, outsideRadius).
-
drawTorusSolenoid
public static void drawTorusSolenoid(PGraphics pGraphics)
Same asdrawTorusSolenoid(pGraphics, 6).- See Also:
drawTorusSolenoid(PGraphics, float)
-
drawTorusSolenoid
public static void drawTorusSolenoid(PGraphics pGraphics, float insideRadius)
Same asdrawTorusSolenoid(pGraphics, 6, insideRadius).- See Also:
drawTorusSolenoid(PGraphics, float)
-
drawTorusSolenoid
public static void drawTorusSolenoid(PGraphics pGraphics, int faces, float insideRadius)
Same asdrawTorusSolenoid(pGraphics, faces, 100, insideRadius, insideRadius * 1.3f).
-
drawTorusSolenoid
public static void drawTorusSolenoid(PGraphics pGraphics, int faces, int detail, float insideRadius, float outsideRadius)
Draws a torus solenoid ontopGraphics.Code contributed by Jacques Maire (http://www.alcys.com/) See also: http://www.mathcurve.com/courbes3d/solenoidtoric/solenoidtoric.shtml http://crazybiocomputing.blogspot.fr/2011/12/3d-curves-toric-solenoids.html
- Parameters:
faces-detail-insideRadius-outsideRadius-
-
drawCone
public void drawCone(PGraphics pGraphics, float height, float a, float b, int detail)
Draws a cone ontopGraphicscentered at(0,0)having Semi-axisaandbandheightdimensions.arepresents the horizontal semi-axisbrepresents the horizontal semi-axis- Parameters:
pGraphics-height-a-b-detail-
-
drawCone
public void drawCone(PGraphics pGraphics, float height, List<Vector> vertices)
Draws a cone ontopGraphicscentered at(0,0)whereverticesrepresents a polygon on XY Plane and withheightas height.- Parameters:
pGraphics-height-vertices-
-
drawCone
public void drawCone(PGraphics pGraphics, List<Vector> vertices, float scale)
Draws a cone ontopGraphicscentered at(0,0,0)whereverticesrepresents the base of the Polygon and withscaleas maximum height.It is desirable that each point in
verticeslie inside the unit Sphere- Parameters:
pGraphics-vertices-scale-
-
drawArc
public void drawArc(PGraphics pGraphics, float radius, float minAngle, float maxAngle, int detail)
Draws an Arc ontopGraphicscentered at(0,0)on the XY PlaneminAngleandmaxAnglerepresents the Arc's width.- Parameters:
pGraphics-radius-minAngle-maxAngle-detail-
-
hasFocus
public boolean hasFocus()
Same asreturn hasFocus(pApplet.mouseX, pApplet.mouseY).- See Also:
Graph.hasFocus(int, int)
-
mouseDX
public float mouseDX()
Returns the last horizontal mouse displacement.
-
mouseRADX
public float mouseRADX()
Same asreturn mouseRADX(PI / width()).- See Also:
mouseRADX(float)
-
mouseRADX
public float mouseRADX(float sensitivity)
ConvertsmouseDX()into angular displacement (in radians) according tosensitivityand returns it.
-
mouseDY
public float mouseDY()
Returns the last vertical mouse displacement.
-
mouseRADY
public float mouseRADY()
Same asreturn mouseRADY(PI / height()).- See Also:
mouseRADY(float)
-
mouseRADY
public float mouseRADY(float sensitivity)
ConvertsmouseDY()into angular displacement (in radians) according tosensitivityand returns it.
-
mouseX
public int mouseX()
Returns the current mouse x coordinate.
-
mouseY
public int mouseY()
Returns the current mouse y coordinate.
-
pmouseX
public int pmouseX()
Returns the previous mouse x coordinate.
-
pmouseY
public int pmouseY()
Returns the previous mouse y coordinate.
-
mouseSpeed
public float mouseSpeed()
Returns the mouse speed expressed in pixels per milliseconds.
-
tracks
public boolean tracks(Node node)
Same asreturn super.tracks(node, mouseX(), mouseY()).- See Also:
Graph.tracks(Node, int, int),mouseX(),mouseY()
-
updateTag
public Node updateTag(List<Node> nodeList)
Same asreturn super.updateTag(mouseX(), mouseY(), nodeList).
-
updateTag
public Node updateTag(String tag, List<Node> nodeList)
Same asreturn super.track(mouse(), nodeList).
-
updateTag
public Node updateTag(Node[] nodeArray)
Same asreturn super.track(mouse(), nodeArray).- See Also:
Graph.updateTag(int, int, Node[])
-
updateTag
public Node updateTag(String tag, Node[] nodes)
Same asreturn super.updateTag(tag, mouseX(), mouseY(), nodes).- See Also:
Graph.updateTag(int, int, Node[]),mouseX(),mouseY()
-
updateTag
public Node updateTag(String tag)
Same asreturn updateTag(null, tag).- See Also:
updateTag(Node, String)
-
updateTag
public Node updateTag()
Same asreturn super.updateTag(mouseX(), mouseY()).- See Also:
Graph.updateTag(Node, String, int, int),mouseX(),mouseY()
-
updateTag
public Node updateTag(Node subtree)
Same asreturn updateTag(subtree, null).- See Also:
updateTag(Node, String)
-
updateTag
public Node updateTag(Node subtree, String tag)
Same asreturn super.updateTag(subtree, tag, mouseX(), mouseY()).- See Also:
Graph.updateTag(Node, String, int, int)
-
tag
public void tag(String tag)
Same assuper.tag(tag, mouseX(), mouseY()).- See Also:
Graph.tag(String, int, int),mouseX(),mouseY()
-
tag
public void tag()
Same assuper.tag(mouseX(), mouseY()).- See Also:
Graph.tag(int, int),mouseX(),mouseY()
-
shift
public void shift()
Same asshift(Graph.inertia).- See Also:
shift(float)
-
shift
public void shift(float inertia)
Same asshift((String)null, inertia).- See Also:
shift(String, float)
-
shift
public void shift(String tag)
Same asshift(tag, Graph.inertia).- See Also:
shift(String, float)
-
shift
public void shift(String tag, float inertia)
Same asif (tag == null || node(tag) != null) shift(node(tag), inertia).- See Also:
shift(Node, float)
-
shift
public void shift(Node node)
Same as .- See Also:
shift(Node, float)
-
shift
public void shift(Node node, float lag)
Same assuper.shift(node, mouseDX() * (1 - lag), mouseDY() * (1 - lag), 0, lag). It tries to keep the node under the mouse cursor independently oflagwhich should be in [0..1], 0 responds immediately and 1 no response at all.
-
spin
public void spin()
Same asspin((String)null).- See Also:
spin(String)
-
spin
public void spin(String tag)
Same asspin(tag, Graph.inertia).- See Also:
spin(String, float)
-
spin
public void spin(float inertia)
Same asspin((String)null, inertia).- See Also:
spin(String, float)
-
spin
public void spin(String tag, float inertia)
Same asif (tag == null || node(tag) != null) spin(node(tag), inertia).- See Also:
spin(Node, float)
-
spin
public void spin(Node node)
Same asspin(node, Graph.inertia).- See Also:
spin(Node, float)
-
spin
public void spin(Node node, float inertia)
Same assuper.spinNode(node, pmouseX(), pmouseY(), mouseX(), mouseY(), inertia).
-
lookAround
public void lookAround(float inertia)
Same assuper.lookAround(mouseRADX(), mouseRADY(), inertia).- See Also:
Graph.lookAround(float, float, float)
-
lookAround
public void lookAround()
Same assuper.lookAround(mouseRADX(), mouseRADY()).- See Also:
Graph.lookAround(float, float),mouseRADX(),mouseRADY()
-
cad
public void cad(float inertia)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), new Vector(0, 1, 0), inertia).- See Also:
Graph.cad(float, float, Vector, float)
-
cad
public void cad()
Same assuper.rotateCAD(mouseRADX(), mouseRADY()).- See Also:
Graph.cad(float, float),mouseRADX(),mouseRADY()
-
cad
public void cad(Vector up, float inertia)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up, inertia).- See Also:
Graph.cad(float, float, Vector, float)
-
cad
public void cad(Vector up)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up).- See Also:
Graph.cad(float, float, Vector),mouseRADX(),mouseRADY()
-
-