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()
:Scene scene; void setup() { scene = new Scene(this); }
context()
corresponds to thePApplet
main canvas.Off-screen scenes should be instantiated upon a
PGraphics
object:Scene 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
PGraphics
parameter (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 theGraph
documentation 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.pmouseX
andPApplet.pmouseY
,mouseDX()
,mouseDY()
,mouseRADX()
andmouseRADY()
variables and thus simplify the method signatures provide by theGraph
counterparts. 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 interface
Scene.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.leftHanded
totrue
.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.leftHanded
totrue
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cad()
Same assuper.rotateCAD(mouseRADX(), mouseRADY())
.void
cad(float inertia)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), new Vector(0, 1, 0), inertia)
.void
cad(Vector up)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up)
.void
cad(Vector up, float inertia)
Same assuper.rotateCAD(mouseRADX(), mouseRADY(), up, inertia)
.PGraphics
context()
Returns the PGraphics instance this scene is related to.void
disableDepthTest()
Disables z-buffer oncontext()
.static void
disableDepthTest(PGraphics pGraphics)
Disables z-buffer onpGraphics
.void
display()
Same asdisplay(null, false, false, null, null, 0, 0)
.void
display(boolean axes)
Same asdisplay(null, axes, null, null, null, 0, 0)
.void
display(boolean axes, int x, int y)
Same asdisplay(null, axes, null, null, null, x, y)
.void
display(boolean axes, Integer grid)
Same asdisplay(null, axes, grid, null, null, 0, 0)
.void
display(boolean axes, Integer grid, int x, int y)
Same asdisplay(null, axes, grid, null, null, x, y)
.void
display(boolean axes, Integer grid, Node subtree)
Same asdisplay(axes, grid, subtree, null, 0, 0)
.void
display(boolean axes, Integer grid, Node subtree, int x, int y)
Same asdisplay(null, axes, grid, subtree, null, x, y)
.void
display(boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)
Same asdisplay(null, axes, grid, subtree, worldCallback, 0, 0)
.void
display(boolean axes, Integer grid, Scene.Callback worldCallback)
Same asdisplay(null, axes, grid, null, worldCallback, 0, 0)
.void
display(boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, axes, grid, null, worldCallback, x, y)
.void
display(boolean axes, Node subtree)
Same asdisplay(null, axes, null, subtree, null, 0, 0)
.void
display(boolean axes, Node subtree, int x, int y)
Same asdisplay(null, axes, null, subtree, null, x, y)
.void
display(boolean axes, Node subtree, Scene.Callback worldCallback)
Same asdisplay(null, axes, null, subtree, worldCallback, 0, 0)
.void
display(boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)
Same asdisplay(null, axes, subtree, worldCallback, cornerX, cornerY)
.void
display(int x, int y)
Same asdisplay(null, false, false, null, null, x, y)
.void
display(Object background)
Same asdisplay(background, false, false, null, null, 0, 0)
.void
display(Object background, boolean axes)
Same asdisplay(background, axes, null, null, null, 0, 0)
.void
display(Object background, boolean axes, int x, int y)
Same asdisplay(background, axes, null, null, null, x, y)
.void
display(Object background, boolean axes, Integer grid)
Same asdisplay(background, axes, grid, null, null, 0, 0)
.void
display(Object background, boolean axes, Integer grid, int x, int y)
Same asdisplay(background, axes, grid, null, null, x, y)
.void
display(Object background, boolean axes, Integer grid, Node subtree)
Same asdisplay(background, axes, grid, subtree, null, 0, 0)
.void
display(Object background, boolean axes, Integer grid, Node subtree, int x, int y)
Same asdisplay(background, axes, grid, subtree, null, x, y)
.void
display(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, axes, grid, subtree, worldCallback, 0, 0)
.void
display(Object background, boolean axes, Integer grid, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)
Display the scene tree.void
display(Object background, boolean axes, Integer grid, Scene.Callback worldCallback)
Same asdisplay(background, axes, grid, null, worldCallback, 0, 0)
.void
display(Object background, boolean axes, Integer grid, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, axes, grid, null, worldCallback, x, y)
.void
display(Object background, boolean axes, Node subtree)
Same asdisplay(background, axes, null, subtree, null, 0, 0)
.void
display(Object background, boolean axes, Node subtree, int x, int y)
Same asdisplay(background, axes, null, subtree, null, x, y)
.void
display(Object background, boolean axes, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, axes, null, subtree, worldCallback, 0, 0)
.void
display(Object background, boolean axes, Node subtree, Scene.Callback worldCallback, int cornerX, int cornerY)
Same asdisplay(background, axes, null, subtree, worldCallback, cornerX, cornerY)
.void
display(Object background, int x, int y)
Same asdisplay(background, false, false, null, null, x, y)
.void
display(Object background, Node subtree)
Same asdisplay(background, false, null, subtree, null, 0, 0)
.void
display(Object background, Node subtree, int x, int y)
Same asdisplay(background, false, null, null, subtree, x, y)
.void
display(Object background, Node subtree, Scene.Callback worldCallback)
Same asdisplay(background, false, null, subtree, worldCallback, 0, 0)
.void
display(Object background, Node subtree, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, false, null, subtree, worldCallback, x, y)
.void
display(Object background, Scene.Callback worldCallback)
Same asdisplay(background, false, false, null, worldCallback, 0, 0)
.void
display(Object background, Scene.Callback worldCallback, int x, int y)
Same asdisplay(background, false, false, null, worldCallback, x, y)
.void
display(Node subtree)
Same asdisplay(null, false, null, subtree, null, 0, 0)
.void
display(Node subtree, int x, int y)
Same asdisplay(null, false, null, null, subtree, x, y)
.void
display(Node subtree, Scene.Callback worldCallback)
Same asdisplay(null, false, null, subtree, worldCallback, 0, 0)
.void
display(Node subtree, Scene.Callback worldCallback, int x, int y)
Same asdisplay(null, false, null, subtree, worldCallback, x, y)
.void
display(Scene.Callback worldCallback)
Same asdisplay(null, false, false, null, worldCallback, 0, 0)
.void
display(Scene.Callback worldCallback, int x, int y)
Same asdisplay(null, false, false, null, worldCallback, x, y)
.void
displayBackBuffer()
Same asdisplayBackBuffer(0, 0)
.void
displayBackBuffer(int background)
Same asdisplayBackBuffer(background, 0, 0)
.void
displayBackBuffer(int pixelX, int pixelY)
Displays the buffer nub use for picking at the given pixel coordinates.void
displayBackBuffer(int background, int pixelX, int pixelY)
Displays the buffer nub use for picking at the given pixel coordinates, withbackground
color.void
dispose()
Same assaveConfig()
.void
drawArc(PGraphics pGraphics, float radius, float minAngle, float maxAngle, int detail)
Draws an Arc ontopGraphics
centered at(0,0)
on the XY PlaneminAngle
andmaxAngle
represents the Arc's width.void
drawArrow(float length)
Simply callsdrawArrow(length, 0.05f * length)
void
drawArrow(float length, float radius)
Draws an arrow ofradius
andlength
along the positive Z axis.void
drawArrow(Vector vector)
Same asdrawArrow(vector, 0.05f * vector.magnitude())
.void
drawArrow(Vector vector, float radius)
Same asdrawArrow(new Vector(), vector, radius)
.void
drawArrow(Vector from, Vector to, float radius)
Draws an arrow ofradius
betweenfrom
and the 3D pointto
.void
drawAxes()
Convenience function that simply callsdrawAxes(radius())
.void
drawAxes(float length)
Same asdrawAxes(context(), length, isLeftHanded())
.void
drawAxes(PGraphics pGraphics)
Same asdrawAxes(pGraphics, radius(), isLeftHanded())
.static void
drawAxes(PGraphics pGraphics, float length)
Draws axes oflength
ontopGraphics
.void
drawCircledBullsEye(float x, float y)
Same asdrawCircledBullsEye(x, y, radius() / 5)
.void
drawCircledBullsEye(float x, float y, float diameter)
void
drawCone(float radius, float height)
Same asdrawCone(12, 0, 0, radius, height)
void
drawCone(float radius1, float radius2, float height)
Same asdrawCone(18, 0, 0, radius1, radius2, height)
.void
drawCone(int detail, float radius, float height)
Same asdrawCone(detail, 0, 0, radius, height)
void
drawCone(int detail, float radius1, float radius2, float height)
Same asdrawCone(detail, 0, 0, radius1, radius2, height)
.void
drawCone(int detail, float x, float y, float radius, float height)
Same asdrawCone(context(), detail, x, y, radius, height)
.void
drawCone(int detail, float x, float y, float radius1, float radius2, float height)
Same asdrawCone(context(), detail, x, y, radius1, radius2, height)
.void
drawCone(PGraphics pGraphics)
Same asdrawCone(pGraphics, 12, 0, 0, radius()/4, sqrt(3) * radius()/4)
.static void
drawCone(PGraphics pGraphics, float radius, float height)
Same asdrawCone(pGraphics, 12, 0, 0, radius, height)
.static void
drawCone(PGraphics pGraphics, float radius1, float radius2, float height)
Same asdrawCone(pGraphics, 18, 0, 0, radius1, radius2, height)
.void
drawCone(PGraphics pGraphics, float height, float a, float b, int detail)
Draws a cone ontopGraphics
centered at(0,0)
having Semi-axisa
andb
andheight
dimensions.void
drawCone(PGraphics pGraphics, float height, List<Vector> vertices)
Draws a cone ontopGraphics
centered at(0,0)
wherevertices
represents a polygon on XY Plane and withheight
as height.static void
drawCone(PGraphics pGraphics, int detail, float radius, float height)
Same asdrawCone(pGraphics, detail, 0, 0, radius, height)
.static void
drawCone(PGraphics pGraphics, int detail, float radius1, float radius2, float height)
Same asdrawCone(pGraphics, detail, 0, 0, radius1, radius2, height)
.static void
drawCone(PGraphics pGraphics, int detail, float x, float y, float radius, float height)
Draws a cone ontopGraphics
centered at(x,y)
havingradius
andheight
dimensions.static void
drawCone(PGraphics pGraphics, int detail, float x, float y, float radius1, float radius2, float height)
Draws a truncated cone ontopGraphics
along the positivez
axis, with its base centered at(x,y)
,height
, and radiiradius1
andradius2
(basis and height respectively).void
drawCone(PGraphics pGraphics, List<Vector> vertices, float scale)
Draws a cone ontopGraphics
centered at(0,0,0)
wherevertices
represents the base of the Polygon and withscale
as maximum height.void
drawCross(float x, float y)
Convenience function that simply callsdrawCross(x, y, radius()/5)
.void
drawCross(float x, float y, float length)
void
drawCross(Node node)
drawCross(float, float, float)
centered at the projected node origin.void
drawCross(Node node, float length)
drawCross(float, float, float)
centered at the projected node origin, havinglength
pixels.void
drawCylinder(float radius, float height)
Same asdrawCylinder(20, radius, height)
.void
drawCylinder(int detail, float radius, float height)
Same asdrawCylinder(context(), detail, radius, height)
.void
drawCylinder(PGraphics pGraphics)
Same asdrawCylinder(context, radius()/6, radius()/3)
.static void
drawCylinder(PGraphics pGraphics, float radius, float height)
Same asdrawCylinder(pGraphics, 20, radius, height)
.static void
drawCylinder(PGraphics pGraphics, int detail, float radius, float height)
Draws a cylinder ofradius
andheight
ontopGraphics
.void
drawDottedGrid()
Convenience function that simply callsdrawDottedGrid(radius(), 10)
.void
drawDottedGrid(float size)
Convenience function that simply callsdrawDottedGrid(size, 10)
.void
drawDottedGrid(float size, int subdivisions)
Same asdrawDottedGrid(context(), size, subdivisions)
.void
drawDottedGrid(int subdivisions)
Convenience function that simplt callsdrawDottedGrid(radius(), subdivisions)
.void
drawDottedGrid(PGraphics pGraphics)
Same asdrawDottedGrid(pGraphics, radius(), 10)
.static void
drawDottedGrid(PGraphics pGraphics, float size, int subdivisions)
Draws a dotted-grid ofsize
ontopGraphics
in the XY plane, centered on (0,0,0), havingsubdivisions
.void
drawFrustum(Graph graph)
Applies thegraph.eye()
transformation and then callsdrawFrustum(PGraphics, Graph)
on the scenecontext()
.static void
drawFrustum(PGraphics pGraphics, Graph graph)
Draws a representation of the viewing frustum ontopGraphics
according tograph.eye()
andgraph._type
.static void
drawFrustum(PGraphics pGraphics, PGraphics eyeBuffer, Node eye, Graph.Type type, float zNear, float zFar)
Draws a representation of theeyeBuffer
frustum ontopGraphics
according to frustum parameters:type
, eyeNode.worldMagnitude()
,zNear
andzFar
, while taking into account whether or not the scene isleftHanded
.void
drawGrid()
Convenience function that simply callsdrawGrid(radius(), 10)
void
drawGrid(float size)
Convenience function that simply callsdrawGrid(size, 10)
void
drawGrid(float size, int subdivisions)
Same asdrawGrid(context(), size, subdivisions)
.void
drawGrid(int subdivisions)
Convenience function that simply callsdrawGrid(radius(), subdivisions)
void
drawGrid(PGraphics pGraphics)
Same asdrawGrid(pGraphics, radius(), 10)
.static void
drawGrid(PGraphics pGraphics, float size, int subdivisions)
Draws a grid ofsize
ontopGraphics
in the XY plane, centered on (0,0,0), havingsubdivisions
.void
drawHollowCylinder(float radius, float height, Vector normal1, Vector normal2)
Same asdrawHollowCylinder(context(), radius, height, normal1, normal2)
.void
drawHollowCylinder(int detail, float radius, float height, Vector normal1, Vector normal2)
Same asdrawHollowCylinder(context(), detail, radius, height, normal1, normal2)
.static void
drawHollowCylinder(PGraphics pGraphics, float radius, float height, Vector normal1, Vector normal2)
Same asdrawHollowCylinder(pGraphics, 30, radius, height, normal1, normal2)
.static void
drawHollowCylinder(PGraphics pGraphics, int detail, float radius, float height, Vector normal1, Vector normal2)
Draws a hollow cylinder ontopGraphics
whose bases are formed by two cutting planes (normal1
andnormal2
), along the positivez
axis.void
drawProjector(Graph eye, Vector point)
Same asdrawProjectors(eye, Arrays.asList(point))
.void
drawProjectors(Graph graph, List<Vector> points)
Draws the projection of each point inpoints
in the near plane ontopGraphics
.void
drawSquaredBullsEye(float x, float y)
Same asdrawSquaredBullsEye(x, y, radius() / 5)
.void
drawSquaredBullsEye(float x, float y, float length)
void
drawTorusSolenoid()
Convenience function that simply callsdrawTorusSolenoid(6)
.void
drawTorusSolenoid(float insideRadius)
Convenience function that simply callsdrawTorusSolenoid(6, insideRadius)
.void
drawTorusSolenoid(int faces)
Convenience function that simply callsdrawTorusSolenoid(faces, 0.07f * radius())
.void
drawTorusSolenoid(int faces, float insideRadius)
Convenience function that simply callsdrawTorusSolenoid(faces, 100, insideRadius, insideRadius * 1.3f)
.void
drawTorusSolenoid(int faces, int detail, float insideRadius, float outsideRadius)
Same asdrawTorusSolenoid(context(), faces, detail, insideRadius, outsideRadius)
.static void
drawTorusSolenoid(PGraphics pGraphics)
Same asdrawTorusSolenoid(pGraphics, 6)
.static void
drawTorusSolenoid(PGraphics pGraphics, float insideRadius)
Same asdrawTorusSolenoid(pGraphics, 6, insideRadius)
.static void
drawTorusSolenoid(PGraphics pGraphics, int faces, float insideRadius)
Same asdrawTorusSolenoid(pGraphics, faces, 100, insideRadius, insideRadius * 1.3f)
.static void
drawTorusSolenoid(PGraphics pGraphics, int faces, int detail, float insideRadius, float outsideRadius)
Draws a torus solenoid ontopGraphics
.void
enableDepthTest()
Enables z-buffer oncontext()
.static void
enableDepthTest(PGraphics pGraphics)
Enables z-buffer onpGraphics
.boolean
hasFocus()
Same asreturn hasFocus(pApplet.mouseX, pApplet.mouseY)
.void
image()
Same asimage(0, 0)
.void
image(int pixelX, int pixelY)
Similar topApplet
image()
.void
line(float x1, float y1, float x2, float y2)
Same ascontext().line(x1, y1, x2, y2)
.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);
.static void
line(PGraphics pGraphics, float x1, float y1, float x2, float y2)
Wrapper for PGraphics.line(x1, y1, x2, y2).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).void
loadConfig()
Same asloadConfig("data/config.json")
.void
loadConfig(String fileName)
Vector
location()
Same asreturn location(mouseX(), mouseY())
.Vector
location(int pixelX, int pixelY)
Returns the world coordinates of the 3D point located at(pixelX, pixelY)
on screen.void
lookAround()
Same assuper.lookAround(mouseRADX(), mouseRADY())
.void
lookAround(float inertia)
Same assuper.lookAround(mouseRADX(), mouseRADY(), inertia)
.float
mouseDX()
Returns the last horizontal mouse displacement.float
mouseDY()
Returns the last vertical mouse displacement.float
mouseRADX()
Same asreturn mouseRADX(PI / width())
.float
mouseRADX(float sensitivity)
ConvertsmouseDX()
into angular displacement (in radians) according tosensitivity
and returns it.float
mouseRADY()
Same asreturn mouseRADY(PI / height())
.float
mouseRADY(float sensitivity)
ConvertsmouseDY()
into angular displacement (in radians) according tosensitivity
and returns it.float
mouseSpeed()
Returns the mouse speed expressed in pixels per milliseconds.int
mouseX()
Returns the current mouse x coordinate.int
mouseY()
Returns the current mouse y coordinate.float
pixelDepth()
Same asreturn pixelDepth(mouseX(), mouseY())
.float
pixelDepth(int pixelX, int pixelY)
Returns the depth (z-value) of the object under thepixel
.void
pixelToLine(Vector origin, Vector direction)
Same aspixelToLine(mouseX(), mouseY(), origin, direction)
.int
pmouseX()
Returns the previous mouse x coordinate.int
pmouseY()
Returns the previous mouse y coordinate.void
saveConfig()
Same assaveConfig("data/config.json")
.void
saveConfig(String fileName)
boolean
setCenter()
Same asreturn setCenter(mouseX(), mouseY())
.boolean
setCenter(int pixelX, int pixelY)
TheGraph.center()
is set to the point located underpixel
on screen.boolean
setCenterFromPixel(int pixelX, int pixelY)
TheGraph.center()
is set to the point located underpixel
on screen.static void
setUniform(PShader shader, String name, Matrix matrix)
Sets thename
shader
uniform frommatrix
.static void
setUniform(PShader shader, String name, Vector vector)
Sets thename
shader
uniform fromvector
.void
shift()
Same asshift(Graph.inertia)
.void
shift(float inertia)
Same asshift((String)null, inertia)
.void
shift(String tag)
Same asshift(tag, Graph.inertia)
.void
shift(String tag, float inertia)
Same asif (tag == null || node(tag) != null) shift(node(tag), inertia)
.void
shift(Node node)
Same as .void
shift(Node node, float lag)
Same assuper.shift(node, mouseDX() * (1 - lag), mouseDY() * (1 - lag), 0, lag)
.void
spin()
Same asspin((String)null)
.void
spin(float inertia)
Same asspin((String)null, inertia)
.void
spin(String tag)
Same asspin(tag, Graph.inertia)
.void
spin(String tag, float inertia)
Same asif (tag == null || node(tag) != null) spin(node(tag), inertia)
.void
spin(Node node)
Same asspin(node, Graph.inertia)
.void
spin(Node node, float inertia)
Same assuper.spinNode(node, pmouseX(), pmouseY(), mouseX(), mouseY(), inertia)
.void
tag()
Same assuper.tag(mouseX(), mouseY())
.void
tag(String tag)
Same assuper.tag(tag, mouseX(), mouseY())
.static Matrix
toMatrix(PMatrix2D pMatrix2D)
Converts a PMatrix2D to aMatrix
.static Matrix
toMatrix(PMatrix3D pMatrix3D)
Converts a PMatrix3D to aMatrix
.static PMatrix3D
toPMatrix(Matrix matrix)
Converts aMatrix
to a PMatrix3D.static PMatrix2D
toPMatrix2D(Matrix matrix)
Converts aMatrix
to a PMatrix2D.static PVector
toPVector(Vector vector)
Converts aVector
to a PVector.static Vector
toVector(PVector pVector)
Converts a PVector to aVector
.boolean
tracks(Node node)
Same asreturn super.tracks(node, mouseX(), mouseY())
.Node
updateTag()
Same asreturn super.updateTag(mouseX(), mouseY())
.Node
updateTag(String tag)
Same asreturn updateTag(null, tag)
.Node
updateTag(String tag, List<Node> nodeList)
Same asreturn super.track(mouse(), nodeList)
.Node
updateTag(String tag, Node[] nodes)
Same asreturn super.updateTag(tag, mouseX(), mouseY(), nodes)
.Node
updateTag(List<Node> nodeList)
Same asreturn super.updateTag(mouseX(), mouseY(), nodeList)
.Node
updateTag(Node subtree)
Same asreturn updateTag(subtree, null)
.Node
updateTag(Node[] nodeArray)
Same asreturn super.track(mouse(), nodeArray)
.Node
updateTag(Node subtree, String tag)
Same asreturn super.updateTag(subtree, tag, mouseX(), mouseY())
.void
vertex(float[] v)
Same asvertex(context(), v)
.void
vertex(float x, float y)
Same asvertex(context(), x, y)
.void
vertex(float x, float y, float z)
Same asif (this.is2D()) vertex(context(), x, y); else vertex(context(), x, y, z)
.void
vertex(float x, float y, float u, float v)
Same asvertex(context(), x, y, u, v)
.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);
.static void
vertex(PGraphics pGraphics, float[] v)
Wrapper for PGraphics.vertex(v)static void
vertex(PGraphics pGraphics, float x, float y)
Wrapper for PGraphics.vertex(x,y)static void
vertex(PGraphics pGraphics, float x, float y, float z)
Wrapper for PGraphics.vertex(x,y,z)static void
vertex(PGraphics pGraphics, float x, float y, float u, float v)
Wrapper for PGraphics.vertex(x,y,u,v)static void
vertex(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.leftHanded
totrue
.
-
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.leftHanded
totrue
.
-
-
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 thename
shader
uniform frommatrix
.
-
setUniform
public static void setUniform(PShader shader, String name, Vector vector)
Sets thename
shader
uniform 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 underpixel
on screen.2D windows always returns true.
3D Cameras returns
true
if a point was found underpixel
andfalse
if 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 underpixel
on screen.Returns
true
if a point was found underpixel
andfalse
if 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 topApplet
image()
. 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
pApplet
image()
, 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, withbackground
color. 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 ofradius
andlength
along 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 ofradius
betweenfrom
and 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 ofradius
andheight
ontopGraphics
.
-
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 ontopGraphics
whose bases are formed by two cutting planes (normal1
andnormal2
), along the positivez
axis.- 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 ontopGraphics
centered at(x,y)
havingradius
andheight
dimensions.
-
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 ontopGraphics
along the positivez
axis, with its base centered at(x,y)
,height
, and radiiradius1
andradius2
(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 oflength
ontopGraphics
.
-
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 ofsize
ontopGraphics
in 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 ofsize
ontopGraphics
in 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 ontopGraphics
according 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 theeyeBuffer
frustum ontopGraphics
according to frustum parameters:type
, eyeNode.worldMagnitude()
,zNear
andzFar
, 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 inpoints
in the near plane ontopGraphics
.This method should be used in conjunction with
drawFrustum(PGraphics, Graph)
.Note that if
graph == this
this 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, havinglength
pixels.- 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 ontopGraphics
centered at(0,0)
having Semi-axisa
andb
andheight
dimensions.a
represents the horizontal semi-axisb
represents the horizontal semi-axis- Parameters:
pGraphics
-height
-a
-b
-detail
-
-
drawCone
public void drawCone(PGraphics pGraphics, float height, List<Vector> vertices)
Draws a cone ontopGraphics
centered at(0,0)
wherevertices
represents a polygon on XY Plane and withheight
as height.- Parameters:
pGraphics
-height
-vertices
-
-
drawCone
public void drawCone(PGraphics pGraphics, List<Vector> vertices, float scale)
Draws a cone ontopGraphics
centered at(0,0,0)
wherevertices
represents the base of the Polygon and withscale
as maximum height.It is desirable that each point in
vertices
lie 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 ontopGraphics
centered at(0,0)
on the XY PlaneminAngle
andmaxAngle
represents 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 tosensitivity
and 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 tosensitivity
and 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 oflag
which 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()
-
-