Module rgg
Package de.grogra.rgg

Class Library

java.lang.Object
de.grogra.rgg.Library

public class Library extends Object
This class contains a collection of methods and constants which are useful in RGG modelling, especially in 3D.
Author:
Ole Kniemeyer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
    This is a redefinition of Graph.BRANCH_EDGE.
    static final int
    CIE Standard Clear Sky (Type 15, CIE 110:2003).
    static final int
    CIE Standard Overcast Sky (Type 1, CIE 110:2003).
    static final int
    CIE partly-cloudy sky with strong circumsolar (Type 7, CIE 110:2003).
    static final int
    This is a redefinition of Graph.CONTAINMENT_EDGE.
    static final int
     
    static float[][]
     
    static String[]
     
    static final int
     
    static final double
    Conversion factor from degree to radians.
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final Vector3d
    Vector pointing in the z-direction (the turtle's head axis).
    static final I18NBundle
    The resource bundle for the de.grogra.rgg package.
    static final int
     
    static final Vector3d
    Vector pointing in the x-direction (the turtle's left axis).
    static final RGGProducer.Creator
     
    static final int
    This is a redefinition of Graph.MARK_EDGE.
    static final int
    This is a redefinition of Instance3D.MASTER.
    static final int
    This is a redefinition of Graph.NOTIFIES_EDGE.
    static final Point3d
    Point having coordinates (0, 0, 0).
    static final PrintWriter
    This field provides a PrintWriter to write to the XL console.
    static final double
    Conversion factor from radians to degree.
    static final int
    This is a redefinition of Graph.REFINEMENT_EDGE.
     
    static final byte
    Constant for NURBSSurface(byte) indicating a skinned surface (defined by a set of profile curves in space).
    static final int
    This is a redefinition of Graph.SUCCESSOR_EDGE.
    static final byte
    Constant for NURBSSurface(byte) indicating a swept surface (defined by a set of vertices in space).
    static final int
    ACES filmic tone mapping (Narkowicz 2015 approximation).
    static final int
    No tone mapping — image returned as-is (exposure and gamma still apply).
    static final int
    Reinhard tone mapping: c = c / (1 + c) per channel.
    static final int
     
    static final Vector3d
    Vector pointing in the y-direction (the turtle's up axis).
    static final int
    This is a redefinition of FieldUpdater.UPDATES.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    absArray(double[] arr)
    Returns a new array with the absolute value of each element.
    static double[]
    addArrays(double[] a, double[] b)
    Returns a new array with element-wise sum of a and b.
    static void
     
    static void
     
    static void
    Deprecated.
    static Node
    ancestor(Node n, ObjectToBoolean<? super Node> condition)
    Returns the nearest ancestor of n which fulfills condition.
    static <C extends Node>
    C
    ancestor(Node n, Class<C> t)
    Returns the nearest ancestor of n which is an instance of t.
    static double
    angle(Node node)
    Computes the rotation angle in degrees of the transformation defined by node.
    static double
     
    static double
    angle2D(double x1, double y1, double x2, double y2)
    Angle (in degrees) of the vector from (x1,y1) to (x2,y2), measured counter-clockwise from the positive X axis.
    static double
    angle3D(Node a, Node b)
    Angle (in degrees) between the growth directions of two nodes.
    static double
    Angle (in degrees) between two 3-D tuples treated as vectors.
    static double
    Angle (in degrees) between two 3-D vectors.
    static void
    Deprecated.
    replaced by derive()
    apply(int count)
    This finish iterator (see the XL Language Specification) is used in a for-statement to execute its body count times.
    This finish iterator (see the XL Language Specification) is used in a for-statement to execute its body as long as the body makes modifications to the graph.
    static int
    argmax(double[] arr)
    Returns the index of the maximum element.
    static int
    argmin(double[] arr)
    Returns the index of the minimum element.
    static Node
     
    static double
    Azimuth of node n's growth direction projected onto the XY plane, measured counter-clockwise from the positive X axis.
    static boolean
    Returns the boolean value which is wrapped in w if w is an instance of BooleanNode.
    static Box
    boundingBox(Node root, boolean includeroot)
     
    static double[]
    boundingBoxCoordinates(Node root, boolean includeroot)
    Calculates the coordinates of the bounding box starting from the root Node.
    static byte
    Returns the byte value which is wrapped in w if w is an instance of ByteNode.
    static void
    chart(DatasetRef ds, int type)
    Shows the data referenced by ds in a chart panel.
    static char
    Returns the char value which is wrapped in w if w is an instance of CharNode.
    static <T extends Comparable<T>>
    T
    clamp(T val, T min, T max)
    Clamps val to the range [min, max].
    static void
    Clears the current console.
    static Node
     
    static Node
    This method clones the subgraph starting at root and returns the cloned node which corresponds to root.
    static void
    Closes the currently active Workbench if such a workbench exists.
    static Null
    ColorBar(ColorGradient cg, boolean label)
    Generates a ColorBar as sequence of 100 Cylinder objects based on the passed ColorGradient instance.
    static Cone
    cone(Node node, boolean end, double angle)
    Returns a cone whose tip is defined by the location of node.
    static Cone
    cone(Tuple3d origin, Vector3d direction, double angle)
    Returns a cone whose tip is located at origin, whose central axis has direction as direction, and whose half opening angle is angle (in degrees).
    static Console
    Returns the currently active Console.
    convexhull(double[] coords)
    Constructs the convex hull of a set of coordinates.
    convexhull(double[] coords, boolean debug)
    Constructs the convex hull of a set of coordinates.
    Constructs the convex hull of all points that can be reached starting from the indicated root node (including the root node).
    convexhull(Node[] nodes)
     
    convexhull(Node root, boolean includeroot)
    Constructs the convex hull of all points that can be reached starting from the indicated root node.
    convexhull(Point3d[] points)
    Constructs the convex hull of a set of points.
    static double
    correlation(double[] x, double[] y)
    Returns the Pearson correlation coefficient of x and y.
    static double
    covariance(double[] x, double[] y)
    Returns the sample covariance of x and y.
    static Vector3d
     
    static double[]
    cumsum(double[] arr)
    Returns a new array of cumulative sums.
    static CurveRef
    curve(String name)
    Returns a CurveRef instance which refers to the curve named name.
    static DatasetRef
    Returns a DatasetRef instance which refers to the dataset named name.
    static void
    Put runnable into modification queue and execute later when derive() is called.
    static double
    deg2rad(double deg)
    Angle in degrees to radiant conversion
    static void
    This method induces a transformation boundary on the current RGG extent (see the XL Language Specification).
    protected static void
     
    static <T> Node
    descendants(ObjectConsumer<? super T> cb, Node n, Class<T> cls)
    This generator method yields all descendants of n which are instances of cls.
    static double[]
    diff(double[] arr)
    Returns a new array of first differences: result[i] = arr[i+1] - arr[i].
    static Vector3d
    Computes the growth direction of the turtle at node in global coordinates.
    static void
    direction(Tuple3d dir, Node node, boolean end)
    Computes the growth direction of the turtle at node in global coordinates.
    static boolean
    directionalTropism(Matrix34d m, Tuple3d direction, float e, Matrix4d out)
    Computes the rotation matrix which implements a directional tropism towards a direction.
    static void
    Disables repaint of View3D panel.
    static double
    dist2D(double x1, double y1, double x2, double y2)
    Euclidean distance between two 2-D points.
    static double
    dist3D(double x1, double y1, double z1, double x2, double y2, double z2)
    Euclidean distance between two explicit 3-D points.
    static double
    Computes the global distance between two nodes.
    static double
     
    static double
    Calculate squared distance between node a an node b.
    static double
    distanceToLine(Tuple3d point, Line line)
    Returns the distance between point and line.
    static int
    distribution(float[] probabilities)
    Returns an integral pseudorandom number according to the discrete distribution probabilities.
    static double
     
    static double
    Returns the double value which is wrapped in w if w is an instance of DoubleNode.
    static String
    dpath(String first, String... more)
    Get path of directory where sections are split with commas.
    static double
    Elevation angle of node n's growth direction above the XY plane.
    protected static void
     
    static void
    Enables repaint of View3D panel after it was deactivated with disableView3DRepaint().
    static Vector3d
    Computes the growth direction of the turtle at the end of node in global coordinates.
    static Point3d
    Computes the end location of node in global coordinates.
    static void
    export3DScene(File file, MimeType format, Boolean onlyVisibleLayer)
    Exports the current 3D scene to the specified target file and format.
    static void
    export3DScene(File file, String format)
    Exports the current 3D scene to the specified target file and format.
    static void
    export3DScene(File file, String format, Node root)
    Exports the specified root node and its children to the specified target file and format.
    static void
    export3DScene(File file, String format, Boolean onlyVisibleLayer)
    Exports the current 3D scene to the specified target file and format.
    static void
    export3DScene(String fileName, MimeType format, Boolean onlyVisibleLayer)
    Exports the current 3D scene to the specified target file and format.
    static void
    export3DScene(String fileName, String format)
    Exports the current 3D scene to the specified target file and format.
    static void
    export3DScene(String fileName, String format, Node root)
    Exports the specified root node and its children to the specified target file and format.
    static void
    export3DScene(String fileName, String format, Boolean onlyVisibleLayer)
    Exports the current 3D scene to the specified target file and format.
    static void
    Writes the current graph to a file.
    static RGGGraph
    Deprecated.
     
    static FileRef
    file(String name)
    Returns a FileRef instance which refers to the file named name.
    static double[]
    fill(int n, double val)
    Returns a new array of n elements all equal to val.
    filter(Class[] classes, boolean isTrue)
    Creates a condition which is fulfilled for an object iff it is an instance of at least one of the specified classes (or iff it is not an instance in case isTrue is false).
     
    static Set<Node>
    Return nodes that connect from n with successor or branch edge
    static Node
    Return node that connect to n with refinement/decomposition edge
    static Set<Node>
    Return nodes that connect from n with refinement/decomposition edge
    static Set<Node>
    Return nodes that connect from n through one or more refinement/decomposition steps, and without any outgoing decomposition edge.
    static Node
    Return node that connect to n with successor or branch edge
    static float
    Returns the float value which is wrapped in w if w is an instance of FloatNode.
    static String
    fpath(String first, String... more)
    Get path of file where sections are split with comas.
    Returns a Function instance which refers to the function named name.
    static Object
    get(Node node, String field)
     
    getAlphaShape(Node root, double alpha)
    Calculates the alhpa shape of all (visible) nodes that can be reached from the given root Node considerring the choosn alpah value.
    getAlphaShape(Point2d[] points, double alpha)
    Calculates the alhpa shape of the given array of points considerring the choosn alpah value.
    static double
    getAreaOfNonTriangulation(float[] pointlist)
    Calculates the area of the surface generated by the specified list of points.
    static double
    Calculates the area of the surface generated by the specified list of points.
    static double
    getAreaOfTriangulation(float[] pointlist)
    Calculates the area of the surface generated by the specified list of points.
    static double
    getAreaOfTriangulation(float scaleX, float scaleY, float scaleZ, float[] pointlist)
    Calculates the area of the surface generated by the specified list of points.
    static double
    Calculates the area of the surface generated by the specified list of points.
    static Point3d[]
    Calculates the bounding rectangle of the given array of points.
    static Camera
     
    static void
    getCameraPosition(double[] vec)
     
    static ShadedNull
    Finds the colosed (euclidian distance) object of type ShadedNull to the parameter n.
    static ShadedNull
    Finds the colosed (euclidian distance) object of type cls to the parameter n.
    static RGBAShader
    Returns the current RGBAShader of n, or null if n is not a ShadedNull or has no shader set.
    getComponentBasedABBHull(Node complexNode, boolean finestComponentBased)
     
    getComponentBasedConvexhull(Node complexNode, boolean finestComponentBased)
     
    static Point3d[]
    Calculates the convex hull of the given array of points.
     
     
    static int
    Returns the GroIMP specific edge bits for a given xml edge type.
    static Object
    return the object of a file in the Project from its name.
    static Set<Node>
     
    static Node
     
    static int
    Get the amount of scale in current groimp multiscale graph.
    static int
    Number of nodes in the main graph.
    Return the input stream of a file from the project.
    static double[]
    getLeafAreaByHeight(Node root, float[] layerCenters, float halfThickness)
    Calculates the total leaf (surface) area per height layer for all ShadedNull nodes in the subgraph rooted at root.
    static float
    Returns the length of n, or Float.NaN if not applicable.
    static int
     
    static MeshNode
    getMesh(double[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    static MeshNode
    getMesh(float[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    static MeshNode
    Returns a MeshNode as visualization of the given convex hull.
    static MeshNode
    getMesh(FloatList vertexData)
    Return a MeshNode in shape of it indicated list of points.
    static MeshNode
    getMesh(Point3d[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    Returns the current meta/registry graph, i.e., the meta/registry graph of the currently active Workbench.
    static Set<Node>
    getNodesAtScale(int scaleNumber)
     
    getOutputStreamFromProject(String fileName, boolean add)
    Return the output stream of a file from the project.
    static String
    Return the path to the home directory.
    static String
    Return the relative path to the current opened workbench.
    static String
     
    getPM(String name)
     
    Returns the current project graph, i.e., the project graph of the currently active Workbench.
    static float
    Returns the radius of n, or Float.NaN if not applicable.
    static Set<Node>
    getRootsAtScale(int scaleNumber)
     
    static int
    Get the scale number, a given node locates at the scale
    static int
    Number of nodes in the scene graph
     
    static double
    Calculates the area of all nodes of the subgraph with the node root as root node Intersection with other object are not considered.The total area will be calculated.
    static ImageRef
    Returns an ImageRef for the named texture.
    static ImageMap
    Returns an ImageMap for the named texture from the TextureLibrary.
    static double
    Determine the time for one repaint of the 3D View window.
    static double
    Determine the time for traversing the whole graph (touching each node once).
    static double
    Calculates the volume of all nodes of the subgraph with the node root as root node.
    static String
    Short for the method getPathToProjectDirectory().
    static float
    Returns the width of n, or Float.NaN if not applicable.
    static float
    Returns the global X coordinate of n's origin.
    static Point3d[]
    getXYProjection(Node root, int type, double alpha)
    Constructs the selected XY-projection of all points that can be reached starting from the indicated root node.
    static Point3d[]
    getXYProjection(Point3d[] pointlist, int type, double alpha)
    Constructs the selected XY-projection of all points in the list.
    static float
    Returns the global Y coordinate of n's origin.
    static float
    Returns the global Z coordinate of n's origin.
    Returns the current project graph, i.e., the project graph of the currently active Workbench.
    static GraphState
    Returns the current graph state, i.e., the current graph state of the project graph of the currently active Workbench.
    static double
    height(Volume volume, double x, double y)
    This method returns the height of a volume at a point (x, y) (in global coordinates).
    static void
    help(String prefix)
    Prints the JavaDoc description of all available commands starting with the specified prefix on the XL console window.
    static void
    hide(Node root)
    Hides the subgraph starting at root so that it is no longer visible and will not be reported as part of graph queries (and left hand sides of rules, thus).
    static double[]
    histogram(double[] data, int bins)
    Returns an array of bins counts representing the histogram of data.
    static double[]
    histogramEdges(double min, double max, int bins)
    Returns an array of bins + 1 equally spaced bin edges from min to max.
    static double
    ifInf(double val, double fallback)
    Returns val if it is finite, otherwise returns fallback.
    static double
    ifNaN(double val, double fallback)
    Returns val if it is not NaN, otherwise returns fallback.
    static float
    ifNaN(float val, float fallback)
    Returns val if it is not NaN, otherwise returns fallback (float overload).
    static <T> T
    ifNull(T val, T fallback)
    Returns val if it is not null, otherwise returns fallback.
    static ImageRef
    image(String name)
    Returns an ImageRef instance which refers to the image named name.
    static void
    import file (from file path) and add it to the scene
    static void
    import file (from inputStream) and add it to the scene
    static double
     
     
    intersect(Line line, Volume volume)
    Compute all intersections between line and the surface of volume.
    static double
    Determines the fraction of the line which intersects the specified cone.
    static int
    Returns the int value which is wrapped in w if w is an instance of IntNode.
    static int
    irandom(int min, int max)
    Returns a uniformly distributed integral pseudorandom number between min and max (inclusive).
    static boolean
    isAncestor(Node a, Node d, int edgeMask)
    Tests whether a is an ancestor of d (or d itself), i.e., if a can be reached from d by a backward traversal of edges matching edgeMask (see Edge.testEdgeBits(int)).
    static <T extends Number>
    boolean
    isInf(T val)
    Returns true if val is infinite (works for Double and Float).
    static <T extends Number>
    boolean
    isNaN(T val)
    Returns true if val is NaN (works for Double and Float).
    static boolean
    Returns true if val can be parsed as a number.
    static boolean
    Determines if n has been selected in the workbench by the user.
    leaf(float length, float width)
    Returns a new, rectangular instance of Parallelogram created by the constructor invocation Parallogram(length, width) and having RGBAShader.GREEN as its shader.
    static MeshNode
    Return a MeshNode in shape of a 3d leaf.
    static MeshNode
    leaf3d(float[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    static MeshNode
    leaf3d(int id)
    Return a MeshNode in shape of it indicated default leaf.
    static double
    length(Tuple3d value)
     
    light(String name)
    Returns a LightDistributionRef instance which refers to the light distribution named name.
    static LightRef
     
    static double[]
    linspace(double start, double stop, int num)
    MATLAB-style linspace: returns num equally spaced values from start to stop (inclusive).
    static void
    Prints the JavaDoc description of all available commands on the XL console window.
    static void
    list(String key)
    Prints a list of all available commands starting with the specified sequence.
    static Node
    load file (from file path) and return the root of the created graph structure
    static Node
    load file (from file input stream) and return the root of the created graph structure
    static void
    Load all the parameters from the parameter managers in the project.
    static Point3d
    location(Node node)
    Computes the location of node in global coordinates.
    static void
    location(Tuple3d loc, Node node, boolean end)
    Computes the location of node in global coordinates.
    static double
    lognormal(double mu, double sigma)
     
    static long
    Returns the long value which is wrapped in w if w is an instance of LongNode.
    static void
    Creates a Twilight rendered image of the actual scene with the default camera position and a fixed image size of 800x600.
    static void
    makeRenderedImage(String fileName, int width, int height)
    Creates a Twilight rendered image of the actual scene with the default camera position and a variable image size.
    static void
    makeRenderedImage(String fileName, Camera camera, int width, int height)
    Creates a rendered image of the actual scene with the specified camera and a variable image size.
    static void
    makeRenderedImage(String fileName, String cameraName, int width, int height)
    Creates a Twilight rendered image of the actual scene with the specified camera and a variable image size.
    static void
    Creates a Flux rendered image of the actual scene with the default camera position and a fixed image size of 800x600.
    static void
    makeRenderedImageFlux(String fileName, int width, int height)
    Creates a Flux rendered image of the actual scene with the default camera position and a variable image size.
    static void
    Creates a Twilight rendered image of the actual scene if no View3D instance is available as it is when running headless, using the default camera position and a fixed image size of 800x600.
    static void
    makeRenderedImageHL(String fileName, int width, int height)
    Creates a Twilight rendered image of the actual scene if no View3D instance is available as it is when running headless, using the default camera position and a variable image size.
    static void
    makeSnapshot(String fileName)
    Creates a snapshot of the actual scene.
    static void
    Marks all points with a Sphere of the given QuickHull3D.
    static void
    markPoints(QuickHull3D hull, float radius)
    Marks all points with a Sphere of the specified radius and of the given QuickHull3D.
    static void
    markPoints(Point3d[] points, float radius, RGBAShader shader)
    Marks all points of the specified array with a Sphere of the specified radius and shader.
    static void
    markPoints(Point3d[] points, float radius, RGBAShader shader, boolean label)
    Marks all points of the specified array with a Sphere of the specified radius and shader.
    static void
    Marks all vertices with a Sphere of the given QuickHull3D.
    static void
    markVertices(QuickHull3D hull, float radius)
    Marks all vertices with a Sphere of the specified radius and of the given QuickHull3D.
    Deprecated.
    static double
    max(double[][] arr)
    Returns the global maximum of all elements in a 2-D array.
    static double
    max(double[][][] arr)
    Returns the global maximum of all elements in a 3-D array.
    static double[][]
    max(double[][][] arr, int dim)
    Returns the element-wise maximum along one dimension of a 3-D array.
    static double[]
    max(double[][] arr, int dim)
    Returns the element-wise maximum along one dimension of a 2-D array.
    static double
    mean(double[][] arr)
    Returns the arithmetic mean of all elements in a 2-D array.
    static double
    mean(double[][][] arr)
    Returns the arithmetic mean of all elements in a 3-D array.
    static double[][]
    mean(double[][][] arr, int dim)
    Returns the arithmetic mean along one dimension of a 3-D array.
    static double[]
    mean(double[][] arr, int dim)
    Returns the arithmetic mean along one dimension of a 2-D array.
    static void
    mean(Aggregate a, Tuple3d value)
    This aggregate method computes the mean of a sequence of Tuple3d's.
    static void
    mean(Aggregate a, Tuple3f value)
    This aggregate method computes the mean of a sequence of Tuple3f's.
    static Null
    MeasuringStick(int steps, float stepsize, boolean label)
    Creates a measuring stick as sequence of steps Cylinder opjects.
    static double
    median(double[] arr)
    Returns the median value.
    static double
    median(double[][] arr)
    Returns the median of all elements in a 2-D array.
    static double
    median(double[][][] arr)
    Returns the median of all elements in a 3-D array.
    static double[][]
    median(double[][][] arr, int dim)
    Returns the median along one dimension of a 3-D array.
    static double[]
    median(double[][] arr, int dim)
    Returns the median along one dimension of a 2-D array.
    static void
    mergeNonTropismTransformations(Node root, boolean allowShape)
    This method replaces chains of transformation nodes with single Null node which perform the aggregated transformation of the chain; however, transformation nodes which are tropisms are not allowed to be part of the chains.
    static void
    mergeNonTropismTransformations(Node root, ObjectToBoolean<? super Node> filter, boolean allowShape)
    This method replaces chains of transformation nodes passing filter with single Null nodes which perform the aggregated transformation of the chains; however, transformation nodes which are tropisms are not allowed to be part of the chains.
    static void
    mergeTransformations(Node root, boolean allowShape)
    This method replaces chains of transformation nodes with single Null nodes which perform the aggregated transformation of the chains.
    static void
    mergeTransformations(Node root, ObjectToBoolean<? super Node> filter, boolean allowShape)
    This method replaces chains of transformation nodes passing filter with single Null nodes which perform the aggregated transformation of the chains.
    static double
    min(double[][] arr)
    Returns the global minimum of all elements in a 2-D array.
    static double
    min(double[][][] arr)
    Returns the global minimum of all elements in a 3-D array.
    static double[][]
    min(double[][][] arr, int dim)
    Returns the element-wise minimum along one dimension of a 3-D array.
    static double[]
    min(double[][] arr, int dim)
    Returns the element-wise minimum along one dimension of a 2-D array.
    static <T> Node
    minDescendants(ObjectConsumer<? super T> cb, Node n, Class<T> t)
    This generator method yields all descendants of n which are instances of t and which have no other instance of t in their path to n.
    static void
    moveToExtent(RGGProducer ps, Node root, int index)
    Sets the extentIndex property of root and its subgraph spanned by EdgePatternImpl.TREE to index.
    static double[]
    multiplyArrays(double[] a, double[] b)
    Returns a new array with element-wise product of a and b.
    static Node
    Returns a node having the specified name.
    static GRSVertex
     
    static double
    norm(Tuple3d value)
     
    static double
    normal(double mu, double sigma)
    Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.
    static float
    normal(float mu, float sigma)
    Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.
    static Vector3d
     
    static double[]
    normalizeArray(double[] arr)
    Returns a new array with values linearly scaled to [0, 1].
    static Vector3d
     
    static Object
    Returns the Object value which is wrapped in w if w is an instance of ObjectNode, NURBSCurve (a NURBSCurve node wraps its contained BSplineCurve) or NURBSSurface (a NURBSSurface node wraps its contained BSplineSurface).
    static double[]
    ones(int n)
    Returns a new array of n ones.
    operator$and(Line line, Volume volume)
    static boolean
    This operator method compares two nodes based on their id: It returns true iff a.getId () >= b.getId ().
    static boolean
    This operator method compares two nodes based on their id: It returns true iff a.getId () > b.getId ().
    static <T> boolean
    operator$in(T value, Collection<? super T> set)
    This operator method returns true iff set is not null and set.contains(value) returns true.
    static Node
    operator$index(Node node, int index)
    This operator method is an alias for node.getChild(index).
    static boolean
     
    static byte
     
    static char
     
    static double
     
    static float
     
    static int
     
    static long
     
    static <T> T
     
    static short
     
    static Point3d
    This operator method returns the location of n.
    static boolean
     
    static double
    This operator method applies the function f to node n.
    static float
    This operator method applies the function f to node n.
    static int
    This operator method applies the function f to node n.
    static float
    operator$index(FloatToFloat func, float x)
    This operator method is an alias for func.evaluateFloat(x).
    static boolean
    operator$index(BooleanList list, int index)
    This operator method is an alias for list.get(index).
    static byte
    operator$index(ByteList list, int index)
    This operator method is an alias for list.get(index).
    static char
    operator$index(CharList list, int index)
    This operator method is an alias for list.get(index).
    static double
    operator$index(DoubleList list, int index)
    This operator method is an alias for list.get(index).
    static float
    operator$index(FloatList list, int index)
    This operator method is an alias for list.get(index).
    static int
    operator$index(IntList list, int index)
    This operator method is an alias for list.get(index).
    static long
    operator$index(LongList list, int index)
    This operator method is an alias for list.get(index).
    static short
    operator$index(ShortList list, int index)
    This operator method is an alias for list.get(index).
    static boolean
    This operator method compares two nodes based on their id: It returns true iff a.getId () invalid input: '<'= b.getId ().
    static boolean
    This operator method compares two nodes based on their id: It returns true iff a.getId () invalid input: '<' b.getId ().
    static void
     
    static void
     
    operator$shl(BooleanList list, boolean value)
    This operator method adds value as last element to list.
    static ByteList
    operator$shl(ByteList list, byte value)
    This operator method adds value as last element to list.
    static CharList
    operator$shl(CharList list, char value)
    This operator method adds value as last element to list.
    static DoubleList
    operator$shl(DoubleList list, double value)
    This operator method adds value as last element to list.
    static FloatList
    operator$shl(FloatList list, float value)
    This operator method adds value as last element to list.
    static IntList
    operator$shl(IntList list, int value)
    This operator method adds value as last element to list.
    static LongList
    operator$shl(LongList list, long value)
    This operator method adds value as last element to list.
    static ShortList
    operator$shl(ShortList list, short value)
    This operator method adds value as last element to list.
    operator$shl(PrintWriter w, boolean v)
    This operator method prints v on w.
    This operator method prints v on w.
    operator$shl(PrintWriter w, double v)
    This operator method prints v on w.
    This operator method prints v on w.
    This operator method prints v on w.
    This operator method prints v on w.
    This operator method prints v on w.
    static <E> List<E>
    operator$shl(List<E> list, E value)
    This operator method adds value as last element to list.
    static void
     
    static void
     
    static void
     
    static void
     
    static void
     
    static void
     
    static Node
    or(Node... nodes)
     
    static <T> List<T>
    Returns a new list with duplicate elements removed, preserving insertion order.
    static <T> List<T>
    orderedUnique(T... items)
    Varargs version: returns a new list of the given items with duplicates removed, preserving insertion order.
    static boolean
    orthogonalTropism(Matrix34d m, Tuple3d direction, float e, Matrix4d out)
    Computes the rotation matrix which implements an orthogonal tropism into a plane perpendicular to direction.
    static void
    Deprecated.
    replaced by derive()
    static double
    percentile(double[] data, double p)
    Returns the p-th percentile of data (p in [0, 100]), using linear interpolation between adjacent ranks.
    static boolean
    plot(Aggregate a, double x, double y)
     
    static boolean
    plot(Aggregate a, DoubleToDouble function, double x)
     
    static boolean
    plot(Aggregate a, IntToDouble function, int x)
     
    static boolean
    plotPoints(Aggregate a, double x, double y)
     
    static boolean
    positionalTropism(Matrix34d m, Tuple3d target, float e, Matrix4d out)
    Computes the rotation matrix which implements a positional tropism towards a target location.
    static void
    print(boolean v)
    Prints v to the XL console.
    static void
    print(char v)
    Prints v to the XL console.
    static void
    print(double v)
    Prints v to the XL console.
    static void
    print(float v)
    Prints v to the XL console.
    static void
    print(int v)
    Prints v to the XL console.
    static void
    print(long v)
    Prints v to the XL console.
    static void
    Prints v to the XL console.
    static void
    print(Object v, int colour)
    Prints v with the specified colour to the XL console.
    static void
    print(String format, Object... args)
    Prints a formatted string to the XL console (C-style format).
    static void
    Terminate the current line by writing the line separator string.
    static void
    println(boolean v)
    Prints v to the XL console, then terminates the line.
    static void
    println(char v)
    Prints v to the XL console, then terminates the line.
    static void
    println(double v)
    Prints v to the XL console, then terminates the line.
    static void
    println(float v)
    Prints v to the XL console, then terminates the line.
    static void
    println(int v)
    Prints v to the XL console, then terminates the line.
    static void
    println(long v)
    Prints v to the XL console, then terminates the line.
    static void
    Prints v to the XL console, then terminates the line.
    static void
    println(Object v, int colour)
    Prints v with the specified colour to the XL console, then terminates the line.
    static void
    println(String format, Object... args)
    Prints a formatted string to the XL console and terminates the line.
    static boolean
    probability(float p)
    Returns the value of a boolean pseudorandom variable whose probability for true is p.
    static Point3d
    pt(double x, double y, double z)
    Convenience constructor: returns new Point3d(x, y, z).
    static Graph
    Get the query graph of the name for the given data graph
    static Graph
     
    static double
    rad2deg(double rad)
    Angle in radiant to degrees conversion
    static double
    random(double min, double max)
    Returns a uniformly distributed pseudorandom double in [min, max].
    static float
    random(float min, float max)
    Returns a uniformly distributed pseudorandom number between min and max.
    static <T> T
    randomChoice(List<T> list)
    Returns a random element from list.
    static <T> T
    randomChoice(T... items)
    Returns a random element from the given items.
    static Vector3d
    Pick a random point on the surface of a unit sphere and return it as direction vector.
    static List<Double>
    range(double start, double stop, double step)
    Returns a list of values from start (inclusive) to stop (exclusive) stepping by step.
    static void
    range(DoubleConsumer consumer, double min, double max)
     
    static void
    range(DoubleConsumer consumer, double min, double max, int n)
     
    static Line
    ray(Tuple3d origin, Tuple3d direction)
    Constructs a Line which represents a ray emanating at origin in the specified direction.
    static double[][]
    readmatrix(String filePath)
    Reads a CSV file and returns its contents as a double[][] matrix.
    static double[][][]
    readmatrix3d(String filePath)
    Reads a page-separated CSV file (written by the 3-D variant of writematrix(double[], java.lang.String)) and returns the result as a double[][][].
    static Reference
    Returns a Reference instance which refers to the object named name.
    static void
     
    static void
    removeLeaves(Node root, ObjectToBoolean<? super Node> filter)
    Removes all leaf nodes from the graph which pass filter, starting at root.
    static void
    Removes all leaf nodes from the graph which are pure transformation nodes (see removeTransformationLeaves(Node, ObjectToBoolean)).
    static void
    Removes all leaf nodes from the graph which are pure transformation nodes and which pass filter, starting at root (see removeLeaves(de.grogra.graph.impl.Node, de.grogra.xl.lang.ObjectToBoolean<? super de.grogra.graph.impl.Node>)).
    static void
    Repaints the View3D panel.
    static <T> T[][]
    reshape(List<T> data, int rows, int cols, Class<T> clazz)
    Reshapes a flat list into a 2-D array with the given dimensions.
    static RGGGraph
     
    static void
    rotateX(Node n, float angleDeg)
    Rotates n around the X axis (left axis) by angleDeg degrees.
    static void
    rotateY(Node n, float angleDeg)
    Rotates n around the Y axis (up axis) by angleDeg degrees.
    static void
    rotateZ(Node n, float angleDeg)
    Rotates n around the Z axis (head axis) by angleDeg degrees.
    static double
    round(double value, int decimals)
    Rounds value to decimals decimal places (HALF_UP).
    static <T> List<T>
    sample(List<T> list, int n)
    Returns a list of n distinct randomly chosen elements from list (sampling without replacement).
    static void
    Save the values of the parameters of each ParameterManager.
    static void
    Save the current project into a .gs or .gsz file.
    static void
    Save the current project into a .gs or .gsz file.
    static Vector3d
    scale(Tuple3d value, double factor)
     
    static void
    scaleNode(Node n, float factor)
    Uniformly scales a node by factor: multiplies length and radius/width by the factor.
    static void
    scaleNode(Node n, float sx, float sy, float sz)
    Non-uniformly scales a node by composing a scale transform into its local TMatrix4d.
    static int
    select(Aggregate a, Node value)
     
    static boolean
    set(Node node, String field, Object val)
     
    static void
    setCIESkyType(int type)
    Sets the CIE Standard General Sky type (1–15) on the CIELighting node in the scene graph.
    static void
    setColor(Node n, float r, float g, float b)
    Sets the shader color of n (must be a ShadedNull).
    static void
    setColor(Node n, float r, float g, float b, float a)
    Sets the shader color of n (must be a ShadedNull).
    static void
    setColor(Node n, int rgb)
    Sets the shader color of n from a packed RGB integer (e.g.\ 0xFF0000 for red).
    static void
     
    static void
    setLength(Node n, float val)
    Sets the length of n.
    static void
    setParameterFile(de.grogra.rgg.parameter.io.ParameterFile pf)
    Set given the parameter file to the default ParameterManager.
    static void
    setParameterFile(de.grogra.rgg.parameter.io.ParameterFile pf, String pmName)
    Set given the parameter file to the ParameterManager of name pmName.
    static void
    setPhotoMode(boolean enabled)
    Enables or disables photo mode using the tone-mode and exposure values from the global Preferences → Renderer → photomode settings.
    static void
    setPhotoMode(boolean enabled, int toneMode)
    Enables or disables photo mode with a specified tone mapping curve.
    static void
    setPhotoMode(boolean enabled, int toneMode, float exposure)
    Enables or disables photo mode with full control.
    static void
    setRadius(Node n, float val)
    Sets the radius of n.
    static void
    setRandomTransform(Null target, Transform3D center, double sigma, double minX, double minY, double maxX, double maxY)
     
    static void
    setSeed(long seed)
    This method sets the seed for the pseudorandom number generator which is used by the random methods in this class.
    static void
    setSkyCloudCover(float fraction)
    Sets the sky from fractional cloud cover (0.0 = clear, 1.0 = overcast) on the CIELighting node in the scene graph.
    static void
    setSkyLatitude(float latitude)
    Sets the geographic latitude on the CIELighting node in the scene graph.
    static void
    setSkyTime(int dayOfYear, int hourOfDay, int minuteOfHour)
    Updates the solar time parameters on the CIELighting node in the scene graph.
    static void
    setSkyTurbidity(float linke)
    Sets the sky from Linke turbidity on the CIELighting node in the scene graph.
    static void
    Displays text in the current status bar.
    static void
    setViewCamera(double rx, double ry, double rz, double tx, double ty, double tz, double scalefactor)
    Set the position, direction and scaling of the View3D window.
    static void
    setWidth(Node n, float val)
    Sets the width of n.
    static void
    setX(Node n, double x)
    Sets the local X translation of n (must be a Null).
    static void
    setY(Node n, double y)
    Sets the local Y translation of n (must be a Null).
    static void
    setZ(Node n, double z)
    Sets the local Z translation of n (must be a Null).
    static ShaderRef
    shader(String name)
    Returns a ShaderRef instance which refers to the shader named name.
    static short
    Returns the short value which is wrapped in w if w is an instance of ShortNode.
    static <T> List<T>
    shuffle(List<T> list)
    Returns a new list with the same elements in a random order.
    Returns a SpectrumRef instance which refers to the spectrum named name.
    static String
    sprintf(String format, Object... args)
    C-style formatted string, equivalent to String.format(format, args).
    static Statistics
    statistics(Aggregate a, double value)
    This aggregate method computes a Statistics object for a series of values a.
    static double
    std(double[] arr)
    Returns the population standard deviation.
    static double
    std(double[][] arr)
    Returns the population standard deviation of all elements in a 2-D array.
    static double
    std(double[][][] arr)
    Returns the population standard deviation of all elements in a 3-D array.
    static double[][]
    std(double[][][] arr, int dim)
    Returns the population standard deviation along one dimension of a 3-D array.
    static double[]
    std(double[][] arr, int dim)
    Returns the population standard deviation along one dimension of a 2-D array.
    static Node
    successor(Node n, ObjectToBoolean<? super Node> condition)
    Returns the nearest successor of n which fulfills condition.
    static double
    sum(double[][] arr)
    Returns the sum of all elements of a 2-D array (equivalent to MATLAB sum(A,'all')).
    static double
    sum(double[][][] arr)
    Returns the sum of all elements of a 3-D array (equivalent to MATLAB sum(A,'all')).
    static double[][]
    sum(double[][][] arr, int dim)
    Returns the sum along one dimension of a 3-D array.
    static double[]
    sum(double[][] arr, int dim)
    Returns the sum along one dimension of a 2-D array.
    static SurfaceRef
    Returns a SurfaceRef instance which refers to the surface named name.
    Surface(byte type)
    Deprecated.
    Surface(byte type, String name, boolean useRail)
    Deprecated.
    Surface(float radius)
    Deprecated.
    Deprecated.
    Deprecated.
    Surface(BSplineCurve profile, String name, boolean useRail)
    Deprecated.
    Deprecated.
    static <T> boolean
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToBoolean<BooleanSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> byte
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToByte<ByteSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> char
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToChar<CharSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> double
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToDouble<DoubleSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> float
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToFloat<FloatSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> int
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToInt<IntSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> long
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToLong<LongSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T, V> V
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToObject<ObjectSynth<? super T,? super V>,? extends V> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static <T> short
    synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToShort<ShortSynth<? super T>> synth)
    This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure.
    static long
    tic()
    Start stopwatch timer tic starts a stopwatch timer to measure performance.
    static long
    toc()
    Read elapsed time from stopwatch toc reads the elapsed time from the stopwatch timer started by the tic function.
    static Line
    toLine(Node node)
    Returns a line which corresponds to the central line of node.
    static ObjectToDouble<double[]>
     
    static Point3d
    The same as location(Node).
    static Point3d
    This autoconversion method returns the first intersection point of list, or null if list is empty.
    static Tuple3d
     
    static Matrix34d
    Computes the global coordinate transformation of the node.
    static Matrix34d
    transformation(Node node, boolean post)
    Computes the global coordinate transformation of the node.
    static void
    translate(Node n, double dx, double dy, double dz)
    Adds (dx, dy, dz) to the local translation of n (must be a Null).
    static MeshNode
    triangulate(float[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    static MeshNode
    triangulate(Point3d[] pointlist)
    Return a MeshNode in shape of it indicated list of points.
    static Null
    tropism(Node a, Point3d target, float e)
    Return a new node with a transformation matrix set to the desired tropism.
    static Null
    tropism(Node a, Vector3d direction, float e)
    Return a new node with a transformation matrix set to the desired tropism.
    static void
    Undo the last derivation step.
    static <T> List<T>
    unique(List<T> list)
    Returns a new list with duplicate elements removed, preserving insertion order.
    static double
    variance(double[] arr)
    Returns the population variance.
    static Vector3d
    vec(double x, double y, double z)
    Convenience constructor: returns new Vector3d(x, y, z).
    static void
     
    void
    visitNodes(Set<Node> set, Node node)
    Put node into the set and visit child nodes.
    static RGBAShader
    visualizeAsColor(double x)
    Returns a color shader whose color represents the value of x which has to lie between -1 and 1.
    static Volume
    volume(Node node)
    Returns a volume which corresponds to the shape of node.
    static float
    W2PPFD(float radiation)
    Converts solar radiation to Photosynthetic Photon Flux Density (PPFD).
    static double
    weighted_avg(double[] values, double[] weights)
    Returns the weighted arithmetic mean.
    static double
    weighted_avg(double[] values, float[] weights)
    Returns the weighted arithmetic mean (double values, float weights).
    static double
    weighted_avg(float[] values, double[] weights)
    Returns the weighted arithmetic mean (float values, double weights).
    static float
    weighted_avg(float[] values, float[] weights)
    Returns the weighted arithmetic mean (float overload).
    static Workbench
    Returns the currently active Workbench.
    static void
    writematrix(double[][][] matrix, String filePath)
    Writes a 3-D matrix to a CSV file.
    static void
    writematrix(double[][] matrix, String filePath)
    Writes a 2-D matrix to a CSV file.
    static void
    writematrix(double[] matrix, String filePath)
    Writes a 1-D array to a CSV file, one value per row.
    static void
    writematrix(float[][] matrix, String filePath)
    Writes a 2-D float matrix to CSV (delegates to double[][] variant).
    static void
    writematrix(float[] matrix, String filePath)
    Writes a 1-D float array to CSV (delegates to double[] variant).
    static void
    writematrix(int[][] matrix, String filePath)
    Writes a 2-D int matrix to CSV (delegates to double[][] variant).
    static void
    writematrix(int[] matrix, String filePath)
    Writes a 1-D int array to CSV (delegates to double[] variant).
    static double[]
    zeros(int n)
    Returns a new array of n zeros.
    static float[]
    zerosF(int n)
    Returns a new float array of n zeros.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Library

      public Library()
  • Method Details

    • console

      public static Console console()
      Returns the currently active Console. This may return null.
      Returns:
      current console or null
    • workbench

      public static Workbench workbench()
      Returns the currently active Workbench. This may return null.
      Returns:
      current workbench or null
    • closeWorkbench

      public static void closeWorkbench()
      Closes the currently active Workbench if such a workbench exists. Note that unsaved modifications are lost, because the user is not asked.
    • graph

      public static GraphManager graph()
      Returns the current project graph, i.e., the project graph of the currently active Workbench. This may return null.
      Returns:
      current project graph or null
    • getProjectGraph

      public static GraphManager getProjectGraph()
      Returns the current project graph, i.e., the project graph of the currently active Workbench. This may return null.
      Returns:
      current project graph or null
    • getMetaGraph

      public static GraphManager getMetaGraph()
      Returns the current meta/registry graph, i.e., the meta/registry graph of the currently active Workbench. This may return null.
      Returns:
      current meta/registry graph or null
    • graphState

      public static GraphState graphState()
      Returns the current graph state, i.e., the current graph state of the project graph of the currently active Workbench.
      Returns:
      current graph state
    • extent

      @Deprecated public static RGGGraph extent()
      Deprecated.
    • rggGraph

      public static RGGGraph rggGraph()
    • allowNoninjectiveMatchesByDefault

      public static void allowNoninjectiveMatchesByDefault(boolean value)
    • allowNoninjectiveMatchesForNextQuery

      @Deprecated public static void allowNoninjectiveMatchesForNextQuery(boolean value)
      Deprecated.
    • setDerivationMode

      public static void setDerivationMode(int mode)
    • tic

      public static long tic()
      Start stopwatch timer tic starts a stopwatch timer to measure performance. The function records the internal time at execution of the tic command. Display the elapsed time with the toc function.
      Returns:
      returns the value of the internal timer [ms] at the execution of the tic command
    • toc

      public static long toc()
      Read elapsed time from stopwatch toc reads the elapsed time from the stopwatch timer started by the tic function. The function reads the internal time at the execution of the toc command, and displays the elapsed time since the most recent call to the tic function, in milliseconds.
      Returns:
      returns the elapsed time; -1, if tic was not called in advance
    • undo

      public static void undo()
      Undo the last derivation step.
    • namedNode

      public static Node namedNode(String name)
      Returns a node having the specified name.
      Parameters:
      name - name of a node
      Returns:
      a node whose name is name, or null if no such node exists
      See Also:
    • setStatus

      public static void setStatus(String text)
      Displays text in the current status bar.
      Parameters:
      text - a text to be displayed
    • chart

      public static void chart(DatasetRef ds, int type)
      Shows the data referenced by ds in a chart panel. type is one of the constants declared in ChartPanel, this specifies the type of chart.
      Parameters:
      ds - reference to a Dataset
      type - chart type
    • axisparent

      public static Node axisparent(Node child)
    • isAncestor

      public static boolean isAncestor(Node a, Node d, int edgeMask)
      Tests whether a is an ancestor of d (or d itself), i.e., if a can be reached from d by a backward traversal of edges matching edgeMask (see Edge.testEdgeBits(int)). Note that this method expects the relevant part of the subgraph spanned by matching edges to be a tree.
      Parameters:
      a - the potential ancestor
      d - the potential descendant
      edgeMask - the edge mask to use
      Returns:
      true iff a is an ancestor of d
    • findComplex

      public static Node findComplex(Node n)
      Return node that connect to n with refinement/decomposition edge
      Parameters:
      n - : a node in the current groimp graph
      Returns:
      Complex node of given node n
    • findComponents

      public static Set<Node> findComponents(Node n)
      Return nodes that connect from n with refinement/decomposition edge
      Parameters:
      n - : a node in the current groimp graph
      Returns:
      A set of component nodes of given node n
    • findFinestComponents

      public static Set<Node> findFinestComponents(Node n)
      Return nodes that connect from n through one or more refinement/decomposition steps, and without any outgoing decomposition edge.
      Parameters:
      n - : a node in the current groimp graph
      Returns:
      A set of component nodes of given node n
    • findParent

      public static Node findParent(Node n)
      Return node that connect to n with successor or branch edge
      Parameters:
      n - : a node in the current groimp graph
      Returns:
      Parent node of given node n
    • findChildren

      public static Set<Node> findChildren(Node n)
      Return nodes that connect from n with successor or branch edge
      Parameters:
      n - : a node in the current groimp graph
      Returns:
      A set of child nodes of given node n
    • getCurrentScaleTypesMap

      public static HashMap<Integer,Set<ManageableType>> getCurrentScaleTypesMap()
    • addOrUpdateTypeGraph

      public static void addOrUpdateTypeGraph()
    • getEdgeBit

      public static int getEdgeBit(String type)
      Returns the GroIMP specific edge bits for a given xml edge type.
      Parameters:
      type -
      Returns:
    • getScaleNumber

      public static int getScaleNumber(Node node)
      Get the scale number, a given node locates at the scale
      Parameters:
      node -
      Returns:
      a sequence number that refers to a scale on the current multiscale groimp graph.
    • getRootsAtScale

      public static Set<Node> getRootsAtScale(int scaleNumber)
      Parameters:
      scaleNumber - : a sequence number that refers to a scale on the current multiscale groimp graph. Attention: the scaleNumber counts from from RGGRoot which is 0
      Returns:
      a set if root nodes at given scale indicating by a sequence number
    • getNodesAtScale

      public static Set<Node> getNodesAtScale(int scaleNumber)
      Parameters:
      scaleNumber - : a sequence number that refers to a scale on the current multiscale groimp graph. Attention: the scaleNumber counts from from RGGRoot which is 0
      Returns:
      a set if nodes at given scale indicating by a sequence number
    • getMaxScaleNumber

      public static int getMaxScaleNumber()
      Returns:
      the max sequence number on the the current multiscale groimp graph.
    • getGraphScaleNumber

      public static int getGraphScaleNumber()
      Get the amount of scale in current groimp multiscale graph.
      Returns:
      an integer stands for the amount of scale
    • getGraphNodes

      public static Set<Node> getGraphNodes()
    • getGraphRoot

      public static Node getGraphRoot()
    • visitGraphNodes

      public static void visitGraphNodes(Set<Node> set, Node node)
      Parameters:
      set -
      node -
    • findAllNodesAtSameScale

      public Set<Node> findAllNodesAtSameScale(Node n)
    • visitNodes

      public void visitNodes(Set<Node> set, Node node)
      Put node into the set and visit child nodes.
      Parameters:
      set -
      node -
    • irandom

      public static int irandom(int min, int max)
      Returns a uniformly distributed integral pseudorandom number between min and max (inclusive).
      Parameters:
      min - minimal value
      max - maximal value
      Returns:
      integral random number between min and max
      See Also:
    • random

      public static float random(float min, float max)
      Returns a uniformly distributed pseudorandom number between min and max.
      Parameters:
      min - minimal value
      max - maximal value
      Returns:
      random number between min and max
      See Also:
    • probability

      public static boolean probability(float p)
      Returns the value of a boolean pseudorandom variable whose probability for true is p.
      Parameters:
      p - probability for true
      Returns:
      random value
      See Also:
    • normal

      public static float normal(float mu, float sigma)
      Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.
      Parameters:
      mu - mean value
      sigma - standard deviation
      Returns:
      normally distributed random number
      See Also:
    • lognormal

      public static double lognormal(double mu, double sigma)
    • normal

      public static double normal(double mu, double sigma)
      Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.
      Parameters:
      mu - mean value
      sigma - standard deviation
      Returns:
      normally distributed random number
      See Also:
    • distribution

      public static int distribution(float[] probabilities)
      Returns an integral pseudorandom number according to the discrete distribution probabilities. The value i has the probability probabilities[i] for 0 invalid input: '<'= i invalid input: '<' probabilities.length, the value probabilities.length has the remaining probability, i.e., the difference between the sum of probabilities and 1.
      Parameters:
      probabilities - array of discrete probabilities
      Returns:
      random number according to probabilities
      See Also:
    • setSeed

      public static void setSeed(long seed)
      This method sets the seed for the pseudorandom number generator which is used by the random methods in this class. This is the generator obtained by Operators.getRandomGenerator() within the current thread.
      Parameters:
      seed - a seed
    • ancestor

      public static <C extends Node> C ancestor(Node n, Class<C> t)
      Returns the nearest ancestor of n which is an instance of t. Ancestors are those nodes which can be reached by traversing successor- or branch-edges backwards.
      Parameters:
      n - a node
      t - the type so search for
      Returns:
      nearest ancestor of type t, or null
    • minDescendants

      public static <T> Node minDescendants(ObjectConsumer<? super T> cb, Node n, Class<T> t)
      This generator method yields all descendants of n which are instances of t and which have no other instance of t in their path to n. Descendants are those nodes which can be reached by traversing successor- or branch-edges forwards.
      Parameters:
      cb - a consumer instance receiving the nodes (provided by the XL compiler)
      n - a node
      t - the type to seach for
      Returns:
      null
    • ancestor

      public static Node ancestor(Node n, ObjectToBoolean<? super Node> condition)
      Returns the nearest ancestor of n which fulfills condition. Ancestors are those nodes which can be reached by traversing successor- or branch-edges backwards.
      Parameters:
      n - a node
      condition - a condition
      Returns:
      nearest ancestor fulfilling condition, or null
    • successor

      public static Node successor(Node n, ObjectToBoolean<? super Node> condition)
      Returns the nearest successor of n which fulfills condition. Successors are those nodes which can be reached by traversing successor-edges forwards.
      Parameters:
      n - a node
      condition - a condition
      Returns:
      nearest successor fulfilling condition, or null
    • descendants

      public static <T> Node descendants(ObjectConsumer<? super T> cb, Node n, Class<T> cls)
      This generator method yields all descendants of n which are instances of cls. Descendants are those nodes which can be reached by traversing successor- or branch-edges forwards.
      Parameters:
      cb - a consumer instance receiving the nodes (provided by the XL compiler)
      n - a node
      cls - the type to seach for
      Returns:
      null
    • filter

      public static NodeFilter<Node> filter(Class[] classes, boolean isTrue)
      Creates a condition which is fulfilled for an object iff it is an instance of at least one of the specified classes (or iff it is not an instance in case isTrue is false).
      Parameters:
      classes - list of classes
      isTrue - condition value iff object is an instance of one of classes
      Returns:
      a condition
    • transformation

      public static Matrix34d transformation(Node node)
      Computes the global coordinate transformation of the node. The returned matrix must not be modified.
      Parameters:
      node - a node
      Returns:
      the node's global coordinate transformation
    • transformation

      public static Matrix34d transformation(Node node, boolean post)
      Computes the global coordinate transformation of the node. If post is false, the transformation of the node itself is returned, otherwise the transformation of its children. These may differ if node induces a change of coordinates. The returned matrix must not be modified.
      Parameters:
      node - a node
      post - true iff the post-transformation (of the node's children) shall be returned
      Returns:
      the node's global coordinate transformation
    • location

      public static void location(Tuple3d loc, Node node, boolean end)
      Computes the location of node in global coordinates. The computed value is written to location. The location is defined by the point (0, 0, 0) in local coordinates of the node if end is false, or of the node's children if end is true.
      Parameters:
      loc - receives the location
      node - a node
      end - use location or end location of node
    • direction

      public static void direction(Tuple3d dir, Node node, boolean end)
      Computes the growth direction of the turtle at node in global coordinates. The computed value is written to direction. The direction is defined by the direction (0, 0, 1) in local coordinates of the node if end is false, or of the node's children if end is true.
      Parameters:
      dir - receives the direction
      node - a node
      end - use location or end location of node
    • location

      public static Point3d location(Node node)
      Computes the location of node in global coordinates. The location is defined by the point (0, 0, 0) in local coordinates.
      Parameters:
      node - a node
      Returns:
      the node's location in global coordinates
      See Also:
    • toPoint3d

      public static Point3d toPoint3d(Node node)
      The same as location(Node). This method is designed as an auto-conversion method.
      Parameters:
      node - a node
      Returns:
      the node's location in global coordinates
    • toTuple3d

      public static Tuple3d toTuple3d(Node node)
    • direction

      public static Vector3d direction(Node node)
      Computes the growth direction of the turtle at node in global coordinates. The direction is defined by the direction (0, 0, 1) in local coordinates.
      Parameters:
      node - a node
      Returns:
      the turtle's growth direction at node
      See Also:
    • extremelocation

      public static ArrayList<Point3d> extremelocation(Node node)
    • getShapeExtremePoints

      public static ArrayList<Point3d> getShapeExtremePoints(Node shapeNode)
    • endlocation

      public static Point3d endlocation(Node node)
      Computes the end location of node in global coordinates. The end location is defined by the point (0, 0, 0) in local coordinates of node's children.
      Parameters:
      node - a node
      Returns:
      the node's end location in global coordinates
      See Also:
    • enddirection

      public static Vector3d enddirection(Node node)
      Computes the growth direction of the turtle at the end of node in global coordinates. The direction is defined by the direction (0, 0, 1) in local coordinates of node's children.
      Parameters:
      node - a node
      Returns:
      the turtle's growth direction at node's children
      See Also:
    • angle

      public static double angle(Node node)
      Computes the rotation angle in degrees of the transformation defined by node. The computed value will be correct if the transformation is a rotation, possibly combined with a uniform scaling.
      Parameters:
      node - a node
      Returns:
      the rotation angle of the transformation of node, in degrees
    • inclination

      public static double inclination(Node node)
    • angle

      public static double angle(Tuple3d a, Tuple3d b)
    • dot

      public static double dot(Tuple3d a, Tuple3d b)
    • norm

      public static double norm(Tuple3d value)
    • length

      public static double length(Tuple3d value)
    • distance

      public static double distance(Tuple3d a, Tuple3d b)
    • cross

      public static Vector3d cross(Tuple3d a, Tuple3d b)
    • normalize

      public static Vector3d normalize(Tuple3d value)
    • normalized

      public static Vector3d normalized(Tuple3d value)
    • scale

      public static Vector3d scale(Tuple3d value, double factor)
    • setRandomTransform

      public static void setRandomTransform(Null target, Transform3D center, double sigma, double minX, double minY, double maxX, double maxY)
    • distanceSquared

      public static double distanceSquared(Node a, Node b)
      Calculate squared distance between node a an node b.
      Parameters:
      a - node a
      b - node b
      Returns:
      squared distance between a and b
    • distance

      public static double distance(Node a, Node b)
      Computes the global distance between two nodes. The distance is measured between the points (0, 0, 0) in the local coordinate systems of the nodes.
      Parameters:
      a - first node
      b - second node
      Returns:
      global distance between nodes
    • cone

      public static Cone cone(Tuple3d origin, Vector3d direction, double angle)
      Returns a cone whose tip is located at origin, whose central axis has direction as direction, and whose half opening angle is angle (in degrees). The cone has no base plane, i.e., it extends to infinity.
      Parameters:
      origin - location of the cone's tip
      direction - direction of the cone's axis
      angle - half opening angle in degrees
      Returns:
      instance of Cone corresponding to the specified geometry
    • cone

      public static Cone cone(Node node, boolean end, double angle)
      Returns a cone whose tip is defined by the location of node. Depending on end, the location or end location of node is used (see location(Tuple3d, Node, boolean)). The axis of the cone points into the local z-direction of the coordinate system of node or node's children (again depending on end). The cone has no base plane, i.e., it extends to infinity.
      Parameters:
      node - node which defines the cone's tip
      end - use location or end location of node
      angle - half opening angle in degrees
      Returns:
      instance of Cone corresponding to the specified geometry
    • ray

      public static Line ray(Tuple3d origin, Tuple3d direction)
      Constructs a Line which represents a ray emanating at origin in the specified direction. The start parameter of the line is set to 0, the end parameter is set to infinity.
      Parameters:
      origin - origin of the ray
      direction - direction of the ray
      Returns:
      new ray
    • intersect

      public static IntersectionList intersect(Line line, Volume volume)
      Compute all intersections between line and the surface of volume. The returned list is valid until the next invocation of this method within the same thread.
      Parameters:
      line - a line
      volume - a volume
      Returns:
      list containing all intersections of the line and the volume's surface
    • operator$and

      public static IntersectionList operator$and(Line line, Volume volume)
      Parameters:
      line - a line
      volume - a volume
      Returns:
      list containing all intersections of the line and the volume's surface
    • toPoint3d

      public static Point3d toPoint3d(IntersectionList list)
      This autoconversion method returns the first intersection point of list, or null if list is empty. The returned point may be modified.
      Parameters:
      list - list of previously computed intersections
      Returns:
      first intersection point, or null
    • height

      public static double height(Volume volume, double x, double y)
      This method returns the height of a volume at a point (x, y) (in global coordinates). This is the maximum z-coordinate of the volume at (x, y). If the volume does not contain a point with matching xy-coordinates, 0 is returned.
      Parameters:
      volume - a volume
      x - global x-coordinate
      y - global y-coordinate
      Returns:
      height of volume at (x, y), or 0
    • toLine

      public static Line toLine(Node node)
      Returns a line which corresponds to the central line of node. The central line starts at the location(Node) of the node and extends to the endlocation(Node) of the node.
      Parameters:
      node - a node
      Returns:
      central line of the node
    • volume

      public static Volume volume(Node node)
      Returns a volume which corresponds to the shape of node. If node has no shape, an empty volume is returned.
      Parameters:
      node - a node
      Returns:
      volume corresponding the node's shape
    • distanceToLine

      public static double distanceToLine(Tuple3d point, Line line)
      Returns the distance between point and line.
      Parameters:
      point - a point
      line - a line
      Returns:
      distance between point and line
      See Also:
    • intersectionLength

      public static double intersectionLength(Line line, Cone cone)
      Determines the fraction of the line which intersects the specified cone.
      Parameters:
      line - line to intersect
      cone - cone to intersect
      Returns:
      fraction of line which intersects cone
    • directionalTropism

      public static boolean directionalTropism(Matrix34d m, Tuple3d direction, float e, Matrix4d out)
      Computes the rotation matrix which implements a directional tropism towards a direction. This is done as follows: The matrix m is interpreted as the transformation matrix from local to global coordinates. Thus, the local z-direction (the growth direction) has the value v = (m.m02, m.m12, m.m22) in global coordinates. Now the cross product d = v0 × direction, where v0 is the unit vector in direction of v, defines the axis about which a rotation has to be performed in order to achieve the desired tropism. This direction is transformed to the local coordinates of m, and out is set to a rotation about this transformed direction, its angle being the length of d multiplied by e (in radians).
      If the absolute value of the angle is less than 1e-10, no rotation matrix is computed and this method returns false. Then out does not contain a valid rotation matrix and should be ignored. This case happens when the growth direction is (anti-)parallel to the desired direction of the tropism.
      Parameters:
      m - transformation matrix from local to global coordinates
      direction - direction of the tropism in global coordinates
      e - strength of the tropism
      out - the computed rotation matrix is placed in here (only valid if the returned value is true)
      Returns:
      true iff a rotation matrix has been computed
    • positionalTropism

      public static boolean positionalTropism(Matrix34d m, Tuple3d target, float e, Matrix4d out)
      Computes the rotation matrix which implements a positional tropism towards a target location. For the details of computation, see directionalTropism(de.grogra.vecmath.Matrix34d, javax.vecmath.Tuple3d, float, javax.vecmath.Matrix4d), where the direction argument is the normalized direction vector from the origin of the local coordinate system (m.m03, m.m13, m.m23) to target.
      If, for mathematical reasons, no rotation matrix can be computed or if no rotation is needed because the local growth direction already points to target, this method returns false. In this case, out does not contain a valid rotation matrix and should be ignored.
      Parameters:
      m - transformation matrix from local to global coordinates
      target - target location of the tropism in global coordinates
      e - strength of the tropism
      out - the computed rotation matrix is placed in here (only valid if the returned value is true)
      Returns:
      true iff a rotation matrix has been computed
    • orthogonalTropism

      public static boolean orthogonalTropism(Matrix34d m, Tuple3d direction, float e, Matrix4d out)
      Computes the rotation matrix which implements an orthogonal tropism into a plane perpendicular to direction. This is done as follows: The matrix m is interpreted as the transformation matrix from local to global coordinates. Thus, the local z-direction (the growth direction) has the value v = (m.m02, m.m12, m.m22) in global coordinates. Now the cross product d = v0 × direction, where v0 is the unit vector in direction of v, defines the axis about which a rotation has to be performed in order to achieve the desired tropism. This direction is transformed to the local coordinates of m, and out is set to a rotation about this transformed direction, its angle being the negated value of the scalar product v0 · direction multiplied by e (in radians).
      If the absolute value of the angle is less than 1e-10, no rotation matrix is computed and this method returns false. Then out does not contain a valid rotation matrix and should be ignored. This case happens when the growth direction is (anti-)parallel to the desired direction of the tropism.
      Parameters:
      m - transformation matrix from local to global coordinates
      direction - direction of the tropism in global coordinates
      e - strength of the tropism
      out - the computed rotation matrix is placed in here (only valid if the returned value is true)
      Returns:
      true iff a rotation matrix has been computed
    • tropism

      public static Null tropism(Node a, Vector3d direction, float e)
      Return a new node with a transformation matrix set to the desired tropism.
      Parameters:
      a - node containing original orientation
      direction - target direction towards the tropism should orient to
      e - strength of the tropism
      Returns:
      a node with a transformation set to the requested tropism
      See Also:
    • tropism

      public static Null tropism(Node a, Point3d target, float e)
      Return a new node with a transformation matrix set to the desired tropism.
      Parameters:
      a - node containing original orientation
      target - target location towards the tropism should orient to
      e - strength of the tropism
      Returns:
      a node with a transformation set to the requested tropism
      See Also:
    • cloneSubgraph

      public static Node cloneSubgraph(Node root) throws CloneNotSupportedException
      This method clones the subgraph starting at root and returns the cloned node which corresponds to root. The subgraph consists of all nodes which can be reached by traversing edges in forward direction. Nodes are cloned deeply, i.e., field values are cloned, too.
      Parameters:
      root - root node of subgraph
      Returns:
      corresponding root node of cloned subgraph
      Throws:
      CloneNotSupportedException
    • cloneNode

      public static Node cloneNode(Node node) throws CloneNotSupportedException
      Throws:
      CloneNotSupportedException
    • booleanValue

      public static boolean booleanValue(Node w)
      Returns the boolean value which is wrapped in w if w is an instance of BooleanNode. Otherwise this method returns false.
      Parameters:
      w - a node
      Returns:
      wrapped boolean value, or false
    • byteValue

      public static byte byteValue(Node w)
      Returns the byte value which is wrapped in w if w is an instance of ByteNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped byte value, or 0
    • shortValue

      public static short shortValue(Node w)
      Returns the short value which is wrapped in w if w is an instance of ShortNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped short value, or 0
    • charValue

      public static char charValue(Node w)
      Returns the char value which is wrapped in w if w is an instance of CharNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped char value, or 0
    • intValue

      public static int intValue(Node w)
      Returns the int value which is wrapped in w if w is an instance of IntNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped int value, or 0
    • longValue

      public static long longValue(Node w)
      Returns the long value which is wrapped in w if w is an instance of LongNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped long value, or 0
    • floatValue

      public static float floatValue(Node w)
      Returns the float value which is wrapped in w if w is an instance of FloatNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped float value, or 0
    • doubleValue

      public static double doubleValue(Node w)
      Returns the double value which is wrapped in w if w is an instance of DoubleNode. Otherwise this method returns 0.
      Parameters:
      w - a node
      Returns:
      wrapped double value, or 0
    • objectValue

      public static Object objectValue(Node w)
      Returns the Object value which is wrapped in w if w is an instance of ObjectNode, NURBSCurve (a NURBSCurve node wraps its contained BSplineCurve) or NURBSSurface (a NURBSSurface node wraps its contained BSplineSurface). Otherwise this method returns null.
      Parameters:
      w - a node
      Returns:
      wrapped Object value, or null
    • isSelected

      public static boolean isSelected(Node n)
      Determines if n has been selected in the workbench by the user.
      Parameters:
      n - a node
      Returns:
      true iff n is contained in the current selection
    • function

      public static FunctionRef function(String name)
      Returns a Function instance which refers to the function named name. The list of functions in GroIMP is available in the panel "Object Explorers/Math Objects/Functions".
      Parameters:
      name - name of function within GroIMP
      Returns:
      FunctionRef referring to the named function
    • curve

      public static CurveRef curve(String name)
      Returns a CurveRef instance which refers to the curve named name. The list of curves in GroIMP is available in the panel "Object Explorers/Math Objects/Curves".
      Parameters:
      name - name of curve within GroIMP
      Returns:
      CurveRef referring to the named curve
    • surface

      public static SurfaceRef surface(String name)
      Returns a SurfaceRef instance which refers to the surface named name. The list of surfaces in GroIMP is available in the panel "Object Explorers/Math Objects/Surfaces".
      Parameters:
      name - name of surface within GroIMP
      Returns:
      SurfaceRef referring to the named surface
    • dataset

      public static DatasetRef dataset(String name)
      Returns a DatasetRef instance which refers to the dataset named name. The list of datasets in GroIMP is available in the panel "Object Explorers/Datasets".
      Parameters:
      name - name of dataset within GroIMP
      Returns:
      DatasetRef referring to the named dataset
    • shader

      public static ShaderRef shader(String name)
      Returns a ShaderRef instance which refers to the shader named name. The list of shaders in GroIMP is available in the panel "Object Explorers/3D/Shaders".
      Parameters:
      name - name of shader within GroIMP
      Returns:
      ShaderRef referring to the named shader
    • lightSource

      public static LightRef lightSource(String name)
    • image

      public static ImageRef image(String name)
      Returns an ImageRef instance which refers to the image named name. The list of images in GroIMP is available in the panel "Object Explorers/Images".
      Parameters:
      name - name of image within GroIMP
      Returns:
      ImageRef referring to the named image
    • spectrum

      public static SpectrumRef spectrum(String name)
      Returns a SpectrumRef instance which refers to the spectrum named name. The list of spectra in GroIMP is available in the panel "Object Explorers/Light Spectra".
      Parameters:
      name - name of spectrum within GroIMP
      Returns:
      ImageRef referring to the named spectrum
    • light

      public static LightDistributionRef light(String name)
      Returns a LightDistributionRef instance which refers to the light distribution named name. The list of light distributionRef in GroIMP is available in the panel "Object Explorers/3D/lights/Light Distribution".
      Parameters:
      name - name of light distribution within GroIMP
      Returns:
      LightDistributionRef referring to the named light distribution.
    • getTexture

      public static ImageRef getTexture(String name)
      Returns an ImageRef for the named texture. Use the BARK_ / LEAF_ constants in this class.
      Parameters:
      name - texture name
      Returns:
      ImageRef referring to the named texture
    • getTextureMap

      public static ImageMap getTextureMap(String name)
      Returns an ImageMap for the named texture from the TextureLibrary. Use the constants defined in this class.
      Parameters:
      name - texture name — one of the BARK_ or LEAF_ constants
      Returns:
      ImageMap referring to the named texture
    • material

      @Deprecated public static MaterialRef material(String name)
      Deprecated.
    • file

      public static FileRef file(String name)
      Returns a FileRef instance which refers to the file named name. The list of files in GroIMP is available in the panel "File Explorer".
      If name does not contain the character '/' or the character IO.SYSTEM_ID_SEPARATOR, name is prefixed by IO.PROJECT_FS followed by IO.SYSTEM_ID_SEPARATOR. Thus, in this case name is assumed to refer to a file in the virtual file system of the project.
      Parameters:
      name - name of file within GroIMP
      Returns:
      FileRef referring to the named file
    • reference

      public static Reference reference(String name)
      Returns a Reference instance which refers to the object named name. The list of objects in GroIMP is available in the panel "Object Explorers/Objects".
      Parameters:
      name - name of object within GroIMP
      Returns:
      Reference referring to the named object
    • exportGraphToFile

      public static void exportGraphToFile(String fileName)
      Writes the current graph to a file.
      Parameters:
      fileName - name of the output file
    • list

      public static void list()
      Prints the JavaDoc description of all available commands on the XL console window.
    • list

      public static void list(String key)
      Prints a list of all available commands starting with the specified sequence.
      Parameters:
      prefix - of the commands
    • help

      public static void help(String prefix)
      Prints the JavaDoc description of all available commands starting with the specified prefix on the XL console window.
      Parameters:
      prefix - of the commands for those the description should be printed
    • setPhotoMode

      public static void setPhotoMode(boolean enabled)
      Enables or disables photo mode using the tone-mode and exposure values from the global Preferences → Renderer → photomode settings. Falls back to ACES tone mapping and exposure 1.0 when those preferences are not found. The live View3D viewport is updated immediately.
      Parameters:
      enabled - true to enable photo mode
    • setPhotoMode

      public static void setPhotoMode(boolean enabled, int toneMode)
      Enables or disables photo mode with a specified tone mapping curve. The live View3D viewport is updated immediately.
      Parameters:
      enabled - true to enable photo mode
      toneMode - one of TONE_NONE, TONE_REINHARD, TONE_ACES
    • setPhotoMode

      public static void setPhotoMode(boolean enabled, int toneMode, float exposure)
      Enables or disables photo mode with full control. The live View3D viewport is updated immediately.
      Parameters:
      enabled - true to enable photo mode
      toneMode - one of TONE_NONE, TONE_REINHARD, TONE_ACES
      exposure - linear exposure multiplier applied before the tone curve (1.0 = neutral)
    • setCIESkyType

      public static void setCIESkyType(int type)
      Sets the CIE Standard General Sky type (1–15) on the CIELighting node in the scene graph. Does nothing if no such node exists.
      Parameters:
      type - CIE sky type 1–15 (use constants CIE_OVERCAST, CIE_PARTLY_CLOUDY, CIE_CLEAR, or any integer 1–15)
    • setSkyCloudCover

      public static void setSkyCloudCover(float fraction)
      Sets the sky from fractional cloud cover (0.0 = clear, 1.0 = overcast) on the CIELighting node in the scene graph.
      Parameters:
      fraction - cloud cover 0.0–1.0
    • setSkyTurbidity

      public static void setSkyTurbidity(float linke)
      Sets the sky from Linke turbidity on the CIELighting node in the scene graph.
      Parameters:
      linke - Linke turbidity factor (typical range 1.5–8)
    • setSkyTime

      public static void setSkyTime(int dayOfYear, int hourOfDay, int minuteOfHour)
      Updates the solar time parameters on the CIELighting node in the scene graph.
      Parameters:
      dayOfYear - day of year [1..365]
      hourOfDay - hour [0..23]
      minuteOfHour - minute [0..59]
    • setSkyLatitude

      public static void setSkyLatitude(float latitude)
      Sets the geographic latitude on the CIELighting node in the scene graph.
      Parameters:
      latitude - geographic latitude [degrees N]
    • makeRenderedImageFlux

      public static void makeRenderedImageFlux(String fileName)
      Creates a Flux rendered image of the actual scene with the default camera position and a fixed image size of 800x600.
      Parameters:
      fileName - name of the output file
    • makeRenderedImageFlux

      public static void makeRenderedImageFlux(String fileName, int width, int height)
      Creates a Flux rendered image of the actual scene with the default camera position and a variable image size.
      Parameters:
      fileName - name of the output file
      width -
      height -
    • makeRenderedImage

      public static void makeRenderedImage(String fileName)
      Creates a Twilight rendered image of the actual scene with the default camera position and a fixed image size of 800x600.
      Parameters:
      fileName - name of the output file
    • makeRenderedImage

      public static void makeRenderedImage(String fileName, int width, int height)
      Creates a Twilight rendered image of the actual scene with the default camera position and a variable image size.
      Parameters:
      fileName - name of the output file
      width -
      height -
    • makeRenderedImageHL

      public static void makeRenderedImageHL(String fileName)
      Creates a Twilight rendered image of the actual scene if no View3D instance is available as it is when running headless, using the default camera position and a fixed image size of 800x600.
      Parameters:
      fileName - name of the output file
    • makeRenderedImageHL

      public static void makeRenderedImageHL(String fileName, int width, int height)
      Creates a Twilight rendered image of the actual scene if no View3D instance is available as it is when running headless, using the default camera position and a variable image size.
      Parameters:
      fileName - name of the output file
      width -
      height -
    • makeRenderedImage

      public static void makeRenderedImage(String fileName, String cameraName, int width, int height)
      Creates a Twilight rendered image of the actual scene with the specified camera and a variable image size.
      Parameters:
      fileName - name of the output file
      cameraName - name of a specific camera
      width -
      height -
    • getCameraPosition

      public static void getCameraPosition(double[] vec)
    • getCameraByName

      public static Camera getCameraByName(String name)
    • makeRenderedImage

      public static void makeRenderedImage(String fileName, Camera camera, int width, int height)
      Creates a rendered image of the actual scene with the specified camera and a variable image size.
      Parameters:
      fileName - name of the output file
      width -
      height -
      specific - camera
    • makeSnapshot

      public static void makeSnapshot(String fileName)
      Creates a snapshot of the actual scene.
      Parameters:
      fileName - name of the output file
    • setViewCamera

      public static void setViewCamera(double rx, double ry, double rz, double tx, double ty, double tz, double scalefactor)
      Set the position, direction and scaling of the View3D window. Use the function to manually control the viewing angle, zoom and position. E.g., setViewCamera(-1.0,0,0.7, 0,-0.5,-5, 0.5);
      Parameters:
      rx - rotation about the x-axes [rad]
      ry - rotation about the y-axes [rad]
      rz - rotation about the z-axes [rad]
      tx - translation along the x-axes [m]
      ty - translation along the y-axes [m]
      tz - translation along the z-axes [m]
      scalefactor - [-]
    • export3DScene

      public static void export3DScene(String fileName, String format, Boolean onlyVisibleLayer) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the current 3D scene to the specified target file and format. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      fileName - name of the output file
      format - target file format
      visibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(File file, String format, Boolean onlyVisibleLayer) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the current 3D scene to the specified target file and format. Check export3DScene for a subgraph 3d export. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      file - output file
      format - target file format
      visibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(String fileName, MimeType format, Boolean onlyVisibleLayer) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the current 3D scene to the specified target file and format.
      Parameters:
      fileName - name of the output file
      format - target file format
      onlyVisibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(File file, MimeType format, Boolean onlyVisibleLayer) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the current 3D scene to the specified target file and format.
      Parameters:
      format - target file format
      onlyVisibleLayer - export only the visibleLayer?
      fileName - name of the output file
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(String fileName, String format) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the current 3D scene to the specified target file and format. Check export3DScene for a subgraph 3d export. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      fileName - name of the output file
      format - target file format
      visibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      Exports the current 3D scene to the specified target file and format. Check export3DScene for a subgraph 3d export. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      file - output file
      format - target file format
      visibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(File file, String format, Node root) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the specified root node and its children to the specified target file and format. Based on export3DScene Check export3DScene for other 3d export options. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      file - output file
      format - target file format
      visibleLayer - export only the visibleLayer?
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • export3DScene

      public static void export3DScene(String fileName, String format, Node root) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Exports the specified root node and its children to the specified target file and format. Check export3DScene for other 3d export options. Currently supported formats of target files: - dxf - x3d - mtg - stl - ply - obj - tex - webgl
      Parameters:
      format - target file format
      root - the root node of the exported graph
      file - output file
      Throws:
      InvocationTargetException
      IllegalAccessException
      InstantiationException
      NoSuchMethodException
    • leaf

      public static Parallelogram leaf(float length, float width)
      Returns a new, rectangular instance of Parallelogram created by the constructor invocation Parallogram(length, width) and having RGBAShader.GREEN as its shader.
      Parameters:
      length - length of rectangle
      width - width of rectangle
      Returns:
      green rectangle
    • leaf3d

      public static MeshNode leaf3d()
      Return a MeshNode in shape of a 3d leaf.
      Returns:
      mash of the default 3d leaf
    • leaf3d

      public static MeshNode leaf3d(int id)
      Return a MeshNode in shape of it indicated default leaf.
      Parameters:
      id - of the indicated leaf
      Returns:
      mash of the default 3d leaf
    • leaf3d

      public static MeshNode leaf3d(float[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points will be automatically triangulated and returned as MeshNode. pointlist={x1,y1,z1, ..., xn,yn,zn).
      Parameters:
      pointlist -
      Returns:
      mash of the pointlist
    • triangulate

      public static MeshNode triangulate(float[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points will be automatically triangulated and returned as MeshNode. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p0,p2,p3}, {p0,p3,p4}, ...}
      Parameters:
      pointlist -
      Returns:
      mash of the pointlist
    • getAreaOfNonTriangulation

      public static double getAreaOfNonTriangulation(float[] pointlist)
      Calculates the area of the surface generated by the specified list of points. The list of points will be automatically triangulated. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p0,p2,p3}, {p0,p3,p4}, ...} Note: Calculation will be wrong, when the described shape is too concave. the resulting area will be too large in this case.
      Parameters:
      pointlist -
      Returns:
      area
    • getAreaOfTriangulation

      public static double getAreaOfTriangulation(float[] pointlist)
      Calculates the area of the surface generated by the specified list of points. It is assumed, that the list of points is triangulated. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p3,p4,p5}, {p6,p7,p8}, ...}
      Parameters:
      pointlist -
      Returns:
      area
    • getAreaOfTriangulation

      public static double getAreaOfTriangulation(float scaleX, float scaleY, float scaleZ, float[] pointlist)
      Calculates the area of the surface generated by the specified list of points. It is assumed, that the list of points is triangulated. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p3,p4,p5}, {p6,p7,p8}, ...} Before the area calculation takes please a scaling is performed.
      Parameters:
      pointlist -
      scaling - factor X
      scaling - factor Y
      scaling - factor Z
      Returns:
      area
    • getMesh

      public static MeshNode getMesh(FloatList vertexData)
      Return a MeshNode in shape of it indicated list of points. The list of points has to be triangulated.
      Parameters:
      vertexData -
      Returns:
      mash of the vertexData
    • triangulate

      public static MeshNode triangulate(Point3d[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points will be automatically triangulated and returned as MeshNode. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p0,p2,p3}, {p0,p3,p4}, ...}
      Parameters:
      pointlist -
      Returns:
      mash of the pointlist
    • getAreaOfNonTriangulation

      public static double getAreaOfNonTriangulation(Point3d[] pointlist)
      Calculates the area of the surface generated by the specified list of points. The list of points will be automatically triangulated. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p0,p2,p3}, {p0,p3,p4}, ...}
      Parameters:
      pointlist -
      Returns:
      area
    • getAreaOfTriangulation

      public static double getAreaOfTriangulation(Point3d[] pointlist)
      Calculates the area of the surface generated by the specified list of points. It is assumed, that the list of points is triangulated. pointlist={x1,y1,z1, ..., xn,yn,zn). First point p0={x1,y1,z1}, faces between {{p0,p1,p2}, {p3,p4,p5}, {p6,p7,p8}, ...}
      Parameters:
      pointlist -
      Returns:
      area
    • getMesh

      public static MeshNode getMesh(Point3d[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points has to be triangulated.
      Parameters:
      vertexData -
      Returns:
      mash of the vertexData
    • getMesh

      public static MeshNode getMesh(QuickHull3D hull)
      Returns a MeshNode as visualization of the given convex hull.
      Parameters:
      hull -
      Returns:
      mash of the vertexData
    • getMesh

      public static MeshNode getMesh(float[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points has to be triangulated.
      Parameters:
      pointlist -
      Returns:
      mash of the vertexData
    • getMesh

      public static MeshNode getMesh(double[] pointlist)
      Return a MeshNode in shape of it indicated list of points. The list of points has to be triangulated. The values of the input list will be casted to float.
      Parameters:
      pointlist -
      Returns:
      mash of the vertexData
    • getSurfaceArea

      public static double getSurfaceArea(Node root)
      Calculates the area of all nodes of the subgraph with the node root as root node Intersection with other object are not considered.The total area will be calculated. Keep in mind, that the getSurfaceArea function is only implemented for basic primitive object. For all other objects it will return zero.
      Returns:
      volume
    • getVolume

      public static double getVolume(Node root)
      Calculates the volume of all nodes of the subgraph with the node root as root node. Intersection with other object are not considered.The total volume will be calculated. Keep in mind, that the getVolume function is only implemented for basic primitive object. For all other objects it will return zero.
      Returns:
      volume
    • getClosesedObject

      public static ShadedNull getClosesedObject(Node n)
      Finds the colosed (euclidian distance) object of type ShadedNull to the parameter n. If there are several nodes with the same shortesed distance, only the first one will be returned
      Parameters:
      n - node from for that the closesed neightbour should be searched.
      Returns:
      instance of the closesed node
    • getClosesedObject

      public static ShadedNull getClosesedObject(Node n, Class<?> cls)
      Finds the colosed (euclidian distance) object of type cls to the parameter n. If there are several nodes with the same shortesed distance, only the first one will be returned
      Parameters:
      n - node from for that the closesed neightbour should be searched.
      cls - class/type of the wanted node to be found
      Returns:
      instance of the closesed node
    • repaintView3D

      public static void repaintView3D()
      Repaints the View3D panel. When repaint of View3D is deactivated it will be reactivated, repainted and disabled again. Makes use of Dummy nodes (and/or artificial changes of the graph to trigger an repaint) unnecessary.
    • disableView3DRepaint

      public static void disableView3DRepaint()
      Disables repaint of View3D panel.
    • enableView3DRepaint

      public static void enableView3DRepaint()
      Enables repaint of View3D panel after it was deactivated with disableView3DRepaint().
    • convexhull

      public static QuickHull3D convexhull(Point3d[] points)
      Constructs the convex hull of a set of points.
      Parameters:
      points - input points
    • convexhull

      public static QuickHull3D convexhull(double[] coords)
      Constructs the convex hull of a set of coordinates. Assuming 3 values for each point: {x0,y0,z0, x1,y1,z1, ...}
      Parameters:
      points - input points
    • convexhull

      public static QuickHull3D convexhull(double[] coords, boolean debug)
      Constructs the convex hull of a set of coordinates. Assuming 3 values for each point: {x0,y0,z0, x1,y1,z1, ...}
      Parameters:
      debug - flag
      points - input points
    • convexhull

      public static QuickHull3D convexhull(Node root)
      Constructs the convex hull of all points that can be reached starting from the indicated root node (including the root node). Only "visible" nodes (nodes instance of ShadedNull) will be take into account. The location (Library.location(Node)) of each node will be taken as position.
      Parameters:
      points - input points
    • convexhull

      public static QuickHull3D convexhull(Node root, boolean includeroot)
      Constructs the convex hull of all points that can be reached starting from the indicated root node. Only "visible" nodes (nodes instance of ShadedNull) will be take into account. The location (Library.location(Node)) of each node will be taken as position.
      Parameters:
      includeroot - input points
      points - input points
    • convexhull

      public static QuickHull3D convexhull(Node[] nodes)
    • boundingBox

      public static Box boundingBox(Node root, boolean includeroot)
    • boundingBoxCoordinates

      public static double[] boundingBoxCoordinates(Node root, boolean includeroot)
      Calculates the coordinates of the bounding box starting from the root Node.
      Parameters:
      root -
      includeroot -
      Returns:
      {minX, maxX, minY, maxY, minZ, maxZ}
    • getComponentBasedABBHull

      public static QuickHull3D getComponentBasedABBHull(Node complexNode, boolean finestComponentBased)
    • getComponentBasedConvexhull

      public static QuickHull3D getComponentBasedConvexhull(Node complexNode, boolean finestComponentBased)
    • markVertices

      public static void markVertices(QuickHull3D hull)
      Marks all vertices with a Sphere of the given QuickHull3D.
      Parameters:
      hull -
    • markVertices

      public static void markVertices(QuickHull3D hull, float radius)
      Marks all vertices with a Sphere of the specified radius and of the given QuickHull3D.
      Parameters:
      hull -
      radius -
    • markPoints

      public static void markPoints(QuickHull3D hull)
      Marks all points with a Sphere of the given QuickHull3D.
      Parameters:
      hull -
    • markPoints

      public static void markPoints(QuickHull3D hull, float radius)
      Marks all points with a Sphere of the specified radius and of the given QuickHull3D.
      Parameters:
      hull -
      radius -
    • markPoints

      public static void markPoints(Point3d[] points, float radius, RGBAShader shader)
      Marks all points of the specified array with a Sphere of the specified radius and shader.
      Parameters:
      radius -
      shader -
      hull -
    • markPoints

      public static void markPoints(Point3d[] points, float radius, RGBAShader shader, boolean label)
      Marks all points of the specified array with a Sphere of the specified radius and shader. Additionally a TextLabel with a consecutive number can be applyed.
      Parameters:
      radius -
      shader -
      label -
      hull -
    • ColorBar

      public static Null ColorBar(ColorGradient cg, boolean label)
      Generates a ColorBar as sequence of 100 Cylinder objects based on the passed ColorGradient instance. hight 1m, radius=0.1m
      Parameters:
      cg - instance of the ColorGradient
      label - flag to indicate labeling
      Returns:
      root node of the sequence
    • MeasuringStick

      public static Null MeasuringStick(int steps, float stepsize, boolean label)
      Creates a measuring stick as sequence of steps Cylinder opjects.
      Parameters:
      steps - number of steps
      stepsize - hight of each Cylinder
      label - flag to indicate labeling
      Returns:
      root node of the sequence
    • getXYProjection

      public static Point3d[] getXYProjection(Node root, int type, double alpha)
      Constructs the selected XY-projection of all points that can be reached starting from the indicated root node. Only "visible" nodes (nodes instance of ShadedNull) will be take into account. The location (Library.location(Node)) of each node will be taken as position. Currently implemented methods: CONVEXHULL .. the convex hull BOUNDING_RECTANGLE .. bounding rectangle ALPHA_SHAPE .. alpha shape with alpha of alpha (Note: In case the alpha shape is not connected, only the first polygon will be returned)
      Parameters:
      root - node
      alpha - value, only used for alpha shapes
      method - of projection
    • getXYProjection

      public static Point3d[] getXYProjection(Point3d[] pointlist, int type, double alpha)
      Constructs the selected XY-projection of all points in the list. Currently implemented methods: CONVEXHULL .. the convex hull BOUNDING_RECTANGLE .. bounding rectangle ALPHA_SHAPE .. alpha shape with alpha of alpha (Note: In case the alpha shape is not connected, only the first polygon will be returned) Returns an array of points: [centroid, p0, p1, p2, ..., pn, p0}; (Repeatation of the first point to close the area (during triangulation))
      Parameters:
      alpha - value, only used for alpha shapes
      input - points
      method - of projection
    • getBoundingRectangle

      public static Point3d[] getBoundingRectangle(Point2d[] points)
      Calculates the bounding rectangle of the given array of points. Returns an array of points: [centroid, (maxX,maxY,0), (minX,maxY,0), (minX,minY,0), (maxX,minY,0), (maxX,maxY,0)}; (Repeatation of the first point to close the area (during triangulation))
      Parameters:
      points -
      Returns:
      array of points
    • getConvexHull2D

      public static Point3d[] getConvexHull2D(Point2d[] points)
      Calculates the convex hull of the given array of points. Returns an array of points: [centroid, p0, p1, p2, ..., pn, p0}; (Repeatation of the first point to close the area (during triangulation))
      Parameters:
      points -
      Returns:
      array of points
    • getAlphaShape

      public static List<Vector<Point3d>> getAlphaShape(Point2d[] points, double alpha)
      Calculates the alhpa shape of the given array of points considerring the choosn alpah value. Returns a List of Vectors of Point3d. Each Vector contains the points of one polygon. In case the resoulting surface is not coherent the List will contain more then one Vector.
      Parameters:
      points -
      alpha - value
      Returns:
      List of Vectors of Point3d, one Vector for each polegon of the surface
    • getAlphaShape

      public static List<Vector<Point3d>> getAlphaShape(Node root, double alpha)
      Calculates the alhpa shape of all (visible) nodes that can be reached from the given root Node considerring the choosn alpah value. Returns a List of Vectors of Point3d. Each Vector contains the points of one polygon. In case the resoulting surface is not coherent the List will contain more then one Vector.
      Parameters:
      alpha - value
      points -
      Returns:
      List of Vectors of Point3d, one Vector for each polegon of the surface
    • Surface

      @Deprecated public static NURBSSurface Surface(BSplineSurface surface)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(BSplineCurve profile)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(float radius)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(byte type)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(BSplineCurveList profiles)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(BSplineCurve profile, String name, boolean useRail)
      Deprecated.
    • Surface

      @Deprecated public static NURBSSurface Surface(byte type, String name, boolean useRail)
      Deprecated.
    • visualizeAsColor

      public static RGBAShader visualizeAsColor(double x)
      Returns a color shader whose color represents the value of x which has to lie between -1 and 1. The color is interpolated between green for 1, white for 0 and red for -1.
      Parameters:
      x - a value between -1 and 1
      Returns:
      a color shader which visualizes x
    • print

      public static void print(Object v, int colour)
      Prints v with the specified colour to the XL console.
      Parameters:
      v - an object
      color - selected printing color (black = 0x000000)
    • print

      public static void print(Object v)
      Prints v to the XL console.
      Parameters:
      v - an object
    • println

      public static void println(Object v, int colour)
      Prints v with the specified colour to the XL console, then terminates the line.
      Parameters:
      v - an object
      color - selected printing color (black = 0x000000)
    • println

      public static void println(Object v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - an object
    • clearConsole

      public static void clearConsole()
      Clears the current console.
    • getTimeForRepaint

      public static double getTimeForRepaint()
      Determine the time for one repaint of the 3D View window.
      Returns:
      time in milliseconds [ms]
    • getTimeForTraversingGraph

      public static double getTimeForTraversingGraph()
      Determine the time for traversing the whole graph (touching each node once).
      Returns:
      time in milliseconds [ms]
    • getGraphSize

      public static int getGraphSize()
      Number of nodes in the main graph. same as count((* Node *))
      Returns:
      int, size of the graph
    • getSceneGraphSize

      public static int getSceneGraphSize()
      Number of nodes in the scene graph. * same as count((* ShadedNull *))
      Returns:
      int, size of the graph
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, Object v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • println

      public static void println()
      Terminate the current line by writing the line separator string.
    • print

      public static void print(boolean v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(boolean v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, boolean v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • print

      public static void print(char v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(char v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, char v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • print

      public static void print(int v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(int v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, int v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • print

      public static void print(long v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(long v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, long v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • print

      public static void print(float v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(float v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, float v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • print

      public static void print(double v)
      Prints v to the XL console.
      Parameters:
      v - value to be printed
    • println

      public static void println(double v)
      Prints v to the XL console, then terminates the line.
      Parameters:
      v - value to be printed
    • operator$shl

      public static PrintWriter operator$shl(PrintWriter w, double v)
      This operator method prints v on w.
      Parameters:
      w - a writer
      v - value to be printed on w
      Returns:
      w
    • operator$index

      public static float operator$index(FloatToFloat func, float x)
      This operator method is an alias for func.evaluateFloat(x).
      Parameters:
      func - a function
      x - argument to the function
      Returns:
      evaluation of func at x
    • operator$shl

      public static <E> List<E> operator$shl(List<E> list, E value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static <T> T operator$index(Node node, ObjectAttribute<T> attr)
    • operator$in

      public static <T> boolean operator$in(T value, Collection<? super T> set)
      This operator method returns true iff set is not null and set.contains(value) returns true.
      Parameters:
      value - a value
      set - a collection
      Returns:
      true iff value is in set
    • synthesize

      public static <T> boolean synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToBoolean<BooleanSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> byte synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToByte<ByteSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> short synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToShort<ShortSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> char synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToChar<CharSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> int synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToInt<IntSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> long synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToLong<LongSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> float synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToFloat<FloatSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T> double synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToDouble<DoubleSynth<? super T>> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • synthesize

      public static <T, V> V synthesize(T root, ObjectToObjectGenerator<? super T,? extends T> generator, ObjectToObject<ObjectSynth<? super T,? super V>,? extends V> synth)
      This method can be used to compute the values of a synthesized attribute for every node of a tree-like structure. A synthesized attribute is an attribute for a node whose value depends on the node and its descendants. root defines the root of the tree-like structure, generator is used to obtain the children of a node, and synth to compute the value of the synthesized attribute at the current node, where the values of its children have been computed previously and are passed to synth.
      Type Parameters:
      T - the type of nodes
      V - the type of values of the synthesized attribute
      Parameters:
      root - root node of structure
      generator - the generator is used to obtain the direct children of the current node
      synth - this function is used to compute the value of the synthesized attribute at a node, given the values of its children
      Returns:
      value of synthesized attribute at root
    • operator$index

      public static boolean operator$index(BooleanList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static BooleanList operator$shl(BooleanList list, boolean value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static boolean operator$index(Node node, BooleanAttribute attr)
    • operator$index

      public static byte operator$index(ByteList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static ByteList operator$shl(ByteList list, byte value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static byte operator$index(Node node, ByteAttribute attr)
    • operator$index

      public static short operator$index(ShortList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static ShortList operator$shl(ShortList list, short value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static short operator$index(Node node, ShortAttribute attr)
    • operator$index

      public static char operator$index(CharList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static CharList operator$shl(CharList list, char value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static char operator$index(Node node, CharAttribute attr)
    • operator$index

      public static int operator$index(IntList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static IntList operator$shl(IntList list, int value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static int operator$index(Node node, IntAttribute attr)
    • operator$index

      public static long operator$index(LongList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static LongList operator$shl(LongList list, long value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static long operator$index(Node node, LongAttribute attr)
    • operator$index

      public static float operator$index(FloatList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static FloatList operator$shl(FloatList list, float value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static float operator$index(Node node, FloatAttribute attr)
    • operator$index

      public static double operator$index(DoubleList list, int index)
      This operator method is an alias for list.get(index).
      Parameters:
      list - a list
      index - an index
      Returns:
      element at index in list
    • operator$shl

      public static DoubleList operator$shl(DoubleList list, double value)
      This operator method adds value as last element to list.
      Parameters:
      list - a list
      value - value to add as last element
      Returns:
      list
    • operator$index

      public static double operator$index(Node node, DoubleAttribute attr)
    • operator$index

      public static Node operator$index(Node node, int index)
      This operator method is an alias for node.getChild(index).
      Parameters:
      node - a node
      index - an index
      Returns:
      index-th child of code
      See Also:
    • operator$lt

      public static boolean operator$lt(Node a, Node b)
      This operator method compares two nodes based on their id: It returns true iff a.getId () invalid input: '<' b.getId ().
      Parameters:
      a - a node
      b - another node
      Returns:
      a.getId () invalid input: '<' b.getId ()
      See Also:
    • operator$le

      public static boolean operator$le(Node a, Node b)
      This operator method compares two nodes based on their id: It returns true iff a.getId () invalid input: '<'= b.getId ().
      Parameters:
      a - a node
      b - another node
      Returns:
      a.getId () invalid input: '<'= b.getId ()
      See Also:
    • operator$gt

      public static boolean operator$gt(Node a, Node b)
      This operator method compares two nodes based on their id: It returns true iff a.getId () > b.getId ().
      Parameters:
      a - a node
      b - another node
      Returns:
      a.getId () > b.getId ()
      See Also:
    • operator$ge

      public static boolean operator$ge(Node a, Node b)
      This operator method compares two nodes based on their id: It returns true iff a.getId () >= b.getId ().
      Parameters:
      a - a node
      b - another node
      Returns:
      a.getId () >= b.getId ()
      See Also:
    • operator$index

      public static int operator$index(Node n, NodeToInt f)
      This operator method applies the function f to node n. It is an alias for f.get(n).
      Parameters:
      n - a node
      f - a function of nodes
      Returns:
      evaluation of f at n
    • operator$index

      public static float operator$index(Node n, NodeToFloat f)
      This operator method applies the function f to node n. It is an alias for f.get(n).
      Parameters:
      n - a node
      f - a function of nodes
      Returns:
      evaluation of f at n
    • operator$index

      public static double operator$index(Node n, NodeToDouble f)
      This operator method applies the function f to node n. It is an alias for f.get(n).
      Parameters:
      n - a node
      f - a function of nodes
      Returns:
      evaluation of f at n
    • operator$index

      public static boolean operator$index(Node n, NodeToBoolean f)
    • operator$index

      public static Point3d operator$index(Node n, Location l)
      This operator method returns the location of n. It is an alias for location(n).
      Parameters:
      n - a node
      l - dummy parameter, its value is ignored
      Returns:
      location of n in global coordinates
      See Also:
    • mean

      public static void mean(Aggregate a, Tuple3f value)
      This aggregate method computes the mean of a sequence of Tuple3f's.
      Parameters:
      a - aggregate instance (provided by the XL compiler)
      value - a value of the sequence of values
    • mean

      public static void mean(Aggregate a, Tuple3d value)
      This aggregate method computes the mean of a sequence of Tuple3d's.
      Parameters:
      a - aggregate instance (provided by the XL compiler)
      value - a value of the sequence of values
    • plot

      public static boolean plot(Aggregate a, IntToDouble function, int x)
    • plot

      public static boolean plot(Aggregate a, DoubleToDouble function, double x)
    • toObjectToDouble

      public static ObjectToDouble<double[]> toObjectToDouble(DoubleToDouble f)
    • plot

      public static boolean plot(Aggregate a, double x, double y)
    • plotPoints

      public static boolean plotPoints(Aggregate a, double x, double y)
    • range

      public static void range(DoubleConsumer consumer, double min, double max)
    • range

      public static void range(DoubleConsumer consumer, double min, double max, int n)
    • select

      public static int select(Aggregate a, Node value)
    • apply

      public static DisposableIterator apply(int count)
      This finish iterator (see the XL Language Specification) is used in a for-statement to execute its body count times. Each execution is surrounded by a transformation boundary (see derive()).
      Parameters:
      count - number of iterations
      Returns:
      a finish iterator
    • applyUntilFinished

      public static DisposableIterator applyUntilFinished()
      This finish iterator (see the XL Language Specification) is used in a for-statement to execute its body as long as the body makes modifications to the graph. Each execution is surrounded by a transformation boundary (see derive()).
      Returns:
      a finish iterator
    • deriveQGraphList

      protected static void deriveQGraphList(Graph caller)
    • emptyQGraphList

      protected static void emptyQGraphList()
    • passBoundary

      @Deprecated public static void passBoundary()
      Deprecated.
      replaced by derive()
    • apply

      @Deprecated public static void apply()
      Deprecated.
      replaced by derive()
    • derive

      public static void derive()
      This method induces a transformation boundary on the current RGG extent (see the XL Language Specification). This means that all pending graph modifications are applied to the graph.
    • newGRSVertices

      public static GRSVertex newGRSVertices(ObjectConsumer<? super GRSVertex> cons)
    • interpretiveRules

      public static DisposableIterator interpretiveRules()
    • removeInterpretiveNodes

      public static void removeInterpretiveNodes()
    • moveToExtent

      public static void moveToExtent(RGGProducer ps, Node root, int index)
      Sets the extentIndex property of root and its subgraph spanned by EdgePatternImpl.TREE to index. If ps is null, the property is modified as part of the active transaction of the graph. Otherwise, the PropertyQueue of ps is used to enqueue the modifications.

      Note that under normal operation, nodes at the Node.LAST_EXTENT_INDEX of the type extent are not returned as part of graph queries.

      Parameters:
      ps - producer to obtain a modification queue, or null
      root - root node of subgraph
      index - new value of the extentTail property of the nodes
    • hide

      public static void hide(Node root)
      Hides the subgraph starting at root so that it is no longer visible and will not be reported as part of graph queries (and left hand sides of rules, thus).

      Technically, this behaviour is achieved by two steps: At first, root is reparented such that it becomes the child of the RGGRoot of this graph, the connection being established by an edge of type Graph.MARK_EDGE. This makes the subgraph invisible. Afterwards, moveToExtent(de.grogra.rgg.model.RGGProducer, de.grogra.graph.impl.Node, int) is invoked in order to move the subgraph to the last list of the type extent. Under normal operation, this excludes the subgraph from being returned as part of graph queries.

      The modifications are made as part of the active transaction of the graph.

      Parameters:
      root - root node of subgraph
    • mergeTransformations

      public static void mergeTransformations(Node root, boolean allowShape)
      This method replaces chains of transformation nodes with single Null nodes which perform the aggregated transformation of the chains. This is the same as mergeTransformations(root, null).
      Parameters:
      root - root node of subgraph where chains should be replaced
      allowShape - store aggregated transformation in shape node at chain end if possible
      See Also:
    • mergeNonTropismTransformations

      public static void mergeNonTropismTransformations(Node root, boolean allowShape)
      This method replaces chains of transformation nodes with single Null node which perform the aggregated transformation of the chain; however, transformation nodes which are tropisms are not allowed to be part of the chains. This is the same as mergeNonTropismTransformations(root, null).
      Parameters:
      root - root node of subgraph where chains should be replaced
      allowShape - store aggregated transformation in shape node at chain end if possible
      See Also:
    • mergeNonTropismTransformations

      public static void mergeNonTropismTransformations(Node root, ObjectToBoolean<? super Node> filter, boolean allowShape)
      This method replaces chains of transformation nodes passing filter with single Null nodes which perform the aggregated transformation of the chains; however, transformation nodes which are tropisms are not allowed to be part of the chains. Tropisms are defined by the subclasses of Tropism.
      Parameters:
      root - root node of subgraph where chains should be replaced
      filter - only merge nodes which pass this filter. If null is specified, every non-tropism transformation node is considered for merging
      See Also:
    • mergeTransformations

      public static void mergeTransformations(Node root, ObjectToBoolean<? super Node> filter, boolean allowShape)
      This method replaces chains of transformation nodes passing filter with single Null nodes which perform the aggregated transformation of the chains. A node is considered to be a transformation node if it has a
      invalid reference
      transformation attribute
      , but no
      invalid reference
      shape attribute
      . If it additionally passes filter and is part of a chain of such nodes, this chain will be replaced by an equivalent single node of class Null.
      Parameters:
      root - root node of subgraph where chains should be replaced
      filter - only merge nodes which pass this filter. If null is specified, every transformation node is considered for merging
      allowShape - if possible, store aggregated transformation in existing shape node at chain end (instead of creating a new Null node)
    • removeTransformationLeaves

      public static void removeTransformationLeaves(Node root)
      Removes all leaf nodes from the graph which are pure transformation nodes (see removeTransformationLeaves(Node, ObjectToBoolean)).
      Parameters:
      root - root node of subgraph whose leaves shall be removed
      See Also:
    • removeTransformationLeaves

      public static void removeTransformationLeaves(Node root, ObjectToBoolean<? super Node> filter)
      Removes all leaf nodes from the graph which are pure transformation nodes and which pass filter, starting at root (see removeLeaves(de.grogra.graph.impl.Node, de.grogra.xl.lang.ObjectToBoolean<? super de.grogra.graph.impl.Node>)). A node is considered to be a pure transformation node if it has a
      invalid reference
      transformation attribute
      , but no
      invalid reference
      shape attribute
      .
      Parameters:
      root - root node of subgraph whose leaves shall be removed
      filter - only leaf nodes which pass this filter are removed. If null, all transformation nodes are considered
      See Also:
    • removeLeaves

      public static void removeLeaves(Node root, ObjectToBoolean<? super Node> filter)
      Removes all leaf nodes from the graph which pass filter, starting at root. A leaf is a node which can be reached from the root by traversing branch or successor edges in forward direction and which has no outgoing edge. If a node which passes filter is no leaf initially, but becomes a leaf due to the removal of its children, it is also removed itself. As a result, the graph finally does not contain any leaves which pass filter.
      Parameters:
      root - root node of subgraph whose leaves shall be removed
      filter - only leaf nodes which pass this filter are removed
    • statistics

      public static Statistics statistics(Aggregate a, double value)
      This aggregate method computes a Statistics object for a series of values a.
      Parameters:
      a - aggregate instance (provided by the XL compiler)
      value - a value of the sequence of values
      Returns:
      statistics of the series of values
    • defer

      public static void defer(Runnable r)
      Put runnable into modification queue and execute later when derive() is called.
      Parameters:
      r -
    • randomDirection

      public static Vector3d randomDirection()
      Pick a random point on the surface of a unit sphere and return it as direction vector.
      Returns:
      random uniformly distributed direction vector
    • getPathToProjectDirectory

      public static String getPathToProjectDirectory()
      Return the relative path to the current opened workbench. The path leads to the .gs or .gsz opened. If the project has not been saved yet, or that the path is set to null. It returns the path to the Home directory.
    • getWD

      public static String getWD()
      Short for the method getPathToProjectDirectory(). Return the relative path to the current opened workbench. The path leads to the .gs or .gsz opened. If the project has not been saved yet, or that the path is set to null. It returns the path to the Home directory.
    • getPathToHomeDirectory

      public static String getPathToHomeDirectory()
      Return the path to the home directory. Independent from the OS used.
    • getPathToProjectFileSystem

      public static String getPathToProjectFileSystem()
    • getFileFromProject

      public static Object getFileFromProject(String fileName)
      return the object of a file in the Project from its name. The returned object is of type File if the project is saved as a .gs. And of type MemoryFileSystem.File if the project is either not saved or saved as .gsz
    • getInputStreamFromProject

      public static InputStream getInputStreamFromProject(String fileName) throws IOException
      Return the input stream of a file from the project. The input stream MUST be closed.
      Throws:
      IOException
    • getOutputStreamFromProject

      public static OutputStream getOutputStreamFromProject(String fileName, boolean add) throws IOException
      Return the output stream of a file from the project. The output stream MUST be closed.
      Throws:
      IOException
    • importNodeFromFile

      public static void importNodeFromFile(String in, String mt)
      import file (from file path) and add it to the scene
    • loadNodeFromFile

      public static Node loadNodeFromFile(String in, String mt)
      load file (from file path) and return the root of the created graph structure
    • importNodeFromStream

      public static void importNodeFromStream(InputStream in, String mt)
      import file (from inputStream) and add it to the scene
    • loadNodeFromStream

      public static Node loadNodeFromStream(InputStream in, String mt)
      load file (from file input stream) and return the root of the created graph structure
    • saveProjectAs

      public static void saveProjectAs(String file)
      Save the current project into a .gs or .gsz file. This do not change the project working directory.
    • saveProjectAs

      public static void saveProjectAs(File file)
      Save the current project into a .gs or .gsz file. This do not change the project working directory.
    • loadPMs

      public static void loadPMs()
      Load all the parameters from the parameter managers in the project. And set the read values to the associated project's variables.
    • setParameterFile

      public static void setParameterFile(de.grogra.rgg.parameter.io.ParameterFile pf)
      Set given the parameter file to the default ParameterManager.
      Parameters:
      pf - : the parameterfile
    • setParameterFile

      public static void setParameterFile(de.grogra.rgg.parameter.io.ParameterFile pf, String pmName)
      Set given the parameter file to the ParameterManager of name pmName.
      Parameters:
      pf - : the parameterfile
      pmName - : the name of the parameter manager
    • savePMs

      public static void savePMs()
      Save the values of the parameters of each ParameterManager. This overwrite the Parameter File value, if any.
    • getDefaultPM

      public static ParameterManager getDefaultPM()
    • getPM

      public static ParameterManager getPM(String name)
    • queryGraph

      public static Graph queryGraph(GraphManager dgraph, String name)
      Get the query graph of the name for the given data graph
    • queryGraph

      public static Graph queryGraph(String name)
    • operator$shl

      public static void operator$shl(Matrix4d out, Null in)
    • operator$shr

      public static void operator$shr(Null in, Matrix4d out)
    • operator$shl

      public static void operator$shl(Null out, Matrix4d in)
    • operator$shr

      public static void operator$shr(Matrix4d in, Null out)
    • operator$shl

      public static void operator$shl(Null out, Null in)
    • operator$shr

      public static void operator$shr(Null out, Null in)
    • operator$ushr

      public static void operator$ushr(Null out, Null in) throws CloneNotSupportedException
      Throws:
      CloneNotSupportedException
    • operator$ushl

      public static void operator$ushl(Null out, Null in) throws CloneNotSupportedException
      Throws:
      CloneNotSupportedException
    • dpath

      public static String dpath(String first, String... more)
      Get path of directory where sections are split with commas. Ends with a file separator.
    • fpath

      public static String fpath(String first, String... more)
      Get path of file where sections are split with comas. The last element is the file.
    • or

      public static Node or(Node... nodes)
    • set

      public static boolean set(Node node, String field, Object val) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • get

      public static Object get(Node node, String field) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • W2PPFD

      public static float W2PPFD(float radiation)
      Converts solar radiation to Photosynthetic Photon Flux Density (PPFD).

      Applies two factors:

      • 0.5 — fraction of total solar radiation that is PAR (400–700 nm)
      • 4.57 — energy-to-photon conversion factor [µmol photons J⁻¹] for PAR
      Because the input is already in watts (= J s⁻¹), no day-length correction is needed.

      Parameters:
      radiation - incident solar radiation [W m⁻²] = [J m⁻² s⁻¹]
      Returns:
      PPFD [µmol m⁻² s⁻¹]
    • getLeafAreaByHeight

      public static double[] getLeafAreaByHeight(Node root, float[] layerCenters, float halfThickness)
      Calculates the total leaf (surface) area per height layer for all ShadedNull nodes in the subgraph rooted at root. Each node is assigned to the layer whose centre is closest to the node's world Z coordinate, within a half-thickness band. Nodes outside all bands are ignored.
      Parameters:
      root - root node of the subgraph to search
      layerCenters - Z coordinates of each layer's centre
      halfThickness - half the layer thickness (layer k spans [centers[k]-half, centers[k]+half))
      Returns:
      array of total surface areas [m²] per layer (same length as layerCenters)
    • linspace

      public static double[] linspace(double start, double stop, int num)
      MATLAB-style linspace: returns num equally spaced values from start to stop (inclusive).
    • range

      public static List<Double> range(double start, double stop, double step)
      Returns a list of values from start (inclusive) to stop (exclusive) stepping by step. Supports negative steps.
    • clamp

      public static <T extends Comparable<T>> T clamp(T val, T min, T max)
      Clamps val to the range [min, max]. Works for any Comparable type (numbers, strings, dates, …).
    • unique

      public static <T> List<T> unique(List<T> list)
      Returns a new list with duplicate elements removed, preserving insertion order.
    • orderedUnique

      public static <T> List<T> orderedUnique(List<T> list)
      Returns a new list with duplicate elements removed, preserving insertion order.
    • orderedUnique

      @SafeVarargs public static <T> List<T> orderedUnique(T... items)
      Varargs version: returns a new list of the given items with duplicates removed, preserving insertion order.
    • round

      public static double round(double value, int decimals)
      Rounds value to decimals decimal places (HALF_UP).
    • sprintf

      public static String sprintf(String format, Object... args)
      C-style formatted string, equivalent to String.format(format, args).
    • print

      public static void print(String format, Object... args)
      Prints a formatted string to the XL console (C-style format). Delegates to print(Object).
    • println

      public static void println(String format, Object... args)
      Prints a formatted string to the XL console and terminates the line. Delegates to println(Object).
    • reshape

      public static <T> T[][] reshape(List<T> data, int rows, int cols, Class<T> clazz)
      Reshapes a flat list into a 2-D array with the given dimensions. data.size() must equal rows * cols.
    • isNumeric

      public static boolean isNumeric(Object val)
      Returns true if val can be parsed as a number.
    • isNaN

      public static <T extends Number> boolean isNaN(T val)
      Returns true if val is NaN (works for Double and Float).
    • isInf

      public static <T extends Number> boolean isInf(T val)
      Returns true if val is infinite (works for Double and Float).
    • zeros

      public static double[] zeros(int n)
      Returns a new array of n zeros.
    • zerosF

      public static float[] zerosF(int n)
      Returns a new float array of n zeros.
    • ones

      public static double[] ones(int n)
      Returns a new array of n ones.
    • fill

      public static double[] fill(int n, double val)
      Returns a new array of n elements all equal to val.
    • weighted_avg

      public static double weighted_avg(double[] values, double[] weights)
      Returns the weighted arithmetic mean.
    • weighted_avg

      public static float weighted_avg(float[] values, float[] weights)
      Returns the weighted arithmetic mean (float overload).
    • weighted_avg

      public static double weighted_avg(double[] values, float[] weights)
      Returns the weighted arithmetic mean (double values, float weights).
    • weighted_avg

      public static double weighted_avg(float[] values, double[] weights)
      Returns the weighted arithmetic mean (float values, double weights).
    • median

      public static double median(double[] arr)
      Returns the median value. Does not modify the input array.
    • variance

      public static double variance(double[] arr)
      Returns the population variance.
    • std

      public static double std(double[] arr)
      Returns the population standard deviation.
    • cumsum

      public static double[] cumsum(double[] arr)
      Returns a new array of cumulative sums.
    • diff

      public static double[] diff(double[] arr)
      Returns a new array of first differences: result[i] = arr[i+1] - arr[i]. Length is arr.length - 1.
    • normalizeArray

      public static double[] normalizeArray(double[] arr)
      Returns a new array with values linearly scaled to [0, 1]. If all values are equal the array is returned as-is.
    • absArray

      public static double[] absArray(double[] arr)
      Returns a new array with the absolute value of each element.
    • multiplyArrays

      public static double[] multiplyArrays(double[] a, double[] b)
      Returns a new array with element-wise product of a and b.
    • addArrays

      public static double[] addArrays(double[] a, double[] b)
      Returns a new array with element-wise sum of a and b.
    • argmin

      public static int argmin(double[] arr)
      Returns the index of the minimum element.
    • argmax

      public static int argmax(double[] arr)
      Returns the index of the maximum element.
    • sum

      public static double sum(double[][] arr)
      Returns the sum of all elements of a 2-D array (equivalent to MATLAB sum(A,'all')).
    • sum

      public static double[] sum(double[][] arr, int dim)
      Returns the sum along one dimension of a 2-D array.
      • dim=1 — sum along rows: result[j] = Σ arr[i][j] (length = cols)
      • dim=2 — sum along columns: result[i] = Σ arr[i][j] (length = rows)
    • min

      public static double min(double[][] arr)
      Returns the global minimum of all elements in a 2-D array.
    • min

      public static double[] min(double[][] arr, int dim)
      Returns the element-wise minimum along one dimension of a 2-D array.
      • dim=1 — min along rows: result[j] = min_i arr[i][j] (length = cols)
      • dim=2 — min along columns: result[i] = min_j arr[i][j] (length = rows)
    • max

      public static double max(double[][] arr)
      Returns the global maximum of all elements in a 2-D array.
    • max

      public static double[] max(double[][] arr, int dim)
      Returns the element-wise maximum along one dimension of a 2-D array.
      • dim=1 — max along rows: result[j] = max_i arr[i][j] (length = cols)
      • dim=2 — max along columns: result[i] = max_j arr[i][j] (length = rows)
    • mean

      public static double mean(double[][] arr)
      Returns the arithmetic mean of all elements in a 2-D array.
    • mean

      public static double[] mean(double[][] arr, int dim)
      Returns the arithmetic mean along one dimension of a 2-D array.
      • dim=1 — mean along rows (length = cols)
      • dim=2 — mean along columns (length = rows)
    • median

      public static double median(double[][] arr)
      Returns the median of all elements in a 2-D array. Does not modify the input.
    • median

      public static double[] median(double[][] arr, int dim)
      Returns the median along one dimension of a 2-D array.
      • dim=1 — median along rows (length = cols)
      • dim=2 — median along columns (length = rows)
      Does not modify the input.
    • std

      public static double std(double[][] arr)
      Returns the population standard deviation of all elements in a 2-D array.
    • std

      public static double[] std(double[][] arr, int dim)
      Returns the population standard deviation along one dimension of a 2-D array.
      • dim=1 — std along rows (length = cols)
      • dim=2 — std along columns (length = rows)
    • sum

      public static double sum(double[][][] arr)
      Returns the sum of all elements of a 3-D array (equivalent to MATLAB sum(A,'all')).
    • sum

      public static double[][] sum(double[][][] arr, int dim)
      Returns the sum along one dimension of a 3-D array.
      • dim=1 — sum along pages: result[r][c] = Σ_p arr[p][r][c]
      • dim=2 — sum along rows: result[p][c] = Σ_r arr[p][r][c]
      • dim=3 — sum along cols: result[p][r] = Σ_c arr[p][r][c]
    • min

      public static double min(double[][][] arr)
      Returns the global minimum of all elements in a 3-D array.
    • min

      public static double[][] min(double[][][] arr, int dim)
      Returns the element-wise minimum along one dimension of a 3-D array. See sum(double[][][],int) for dimension convention.
    • max

      public static double max(double[][][] arr)
      Returns the global maximum of all elements in a 3-D array.
    • max

      public static double[][] max(double[][][] arr, int dim)
      Returns the element-wise maximum along one dimension of a 3-D array. See sum(double[][][],int) for dimension convention.
    • mean

      public static double mean(double[][][] arr)
      Returns the arithmetic mean of all elements in a 3-D array.
    • mean

      public static double[][] mean(double[][][] arr, int dim)
      Returns the arithmetic mean along one dimension of a 3-D array. See sum(double[][][],int) for dimension convention.
    • median

      public static double median(double[][][] arr)
      Returns the median of all elements in a 3-D array. Does not modify the input.
    • median

      public static double[][] median(double[][][] arr, int dim)
      Returns the median along one dimension of a 3-D array. See sum(double[][][],int) for dimension convention. Does not modify the input.
    • std

      public static double std(double[][][] arr)
      Returns the population standard deviation of all elements in a 3-D array.
    • std

      public static double[][] std(double[][][] arr, int dim)
      Returns the population standard deviation along one dimension of a 3-D array. See sum(double[][][],int) for dimension convention.
    • setColor

      public static void setColor(Node n, float r, float g, float b)
      Sets the shader color of n (must be a ShadedNull). RGB components in [0, 1].
    • setColor

      public static void setColor(Node n, float r, float g, float b, float a)
      Sets the shader color of n (must be a ShadedNull). RGBA components in [0, 1].
    • setColor

      public static void setColor(Node n, int rgb)
      Sets the shader color of n from a packed RGB integer (e.g.\ 0xFF0000 for red).
    • getColor

      public static RGBAShader getColor(Node n)
      Returns the current RGBAShader of n, or null if n is not a ShadedNull or has no shader set.
    • getX

      public static float getX(Node n)
      Returns the global X coordinate of n's origin.
    • getY

      public static float getY(Node n)
      Returns the global Y coordinate of n's origin.
    • getZ

      public static float getZ(Node n)
      Returns the global Z coordinate of n's origin.
    • setX

      public static void setX(Node n, double x)
      Sets the local X translation of n (must be a Null).
    • setY

      public static void setY(Node n, double y)
      Sets the local Y translation of n (must be a Null).
    • setZ

      public static void setZ(Node n, double z)
      Sets the local Z translation of n (must be a Null).
    • translate

      public static void translate(Node n, double dx, double dy, double dz)
      Adds (dx, dy, dz) to the local translation of n (must be a Null).
    • setLength

      public static void setLength(Node n, float val)
      Sets the length of n. Supports Cylinder, Box, F, and frustum-based shapes.
    • getLength

      public static float getLength(Node n)
      Returns the length of n, or Float.NaN if not applicable.
    • setWidth

      public static void setWidth(Node n, float val)
      Sets the width of n. Supports Box and F (as diameter).
    • getWidth

      public static float getWidth(Node n)
      Returns the width of n, or Float.NaN if not applicable.
    • setRadius

      public static void setRadius(Node n, float val)
      Sets the radius of n. Supports Cylinder and Sphere.
    • getRadius

      public static float getRadius(Node n)
      Returns the radius of n, or Float.NaN if not applicable.
    • scaleNode

      public static void scaleNode(Node n, float factor)
      Uniformly scales a node by factor: multiplies length and radius/width by the factor.
    • scaleNode

      public static void scaleNode(Node n, float sx, float sy, float sz)
      Non-uniformly scales a node by composing a scale transform into its local TMatrix4d. Requires n to be a Null.
    • rotateX

      public static void rotateX(Node n, float angleDeg)
      Rotates n around the X axis (left axis) by angleDeg degrees. Requires n to be a Null.
    • rotateY

      public static void rotateY(Node n, float angleDeg)
      Rotates n around the Y axis (up axis) by angleDeg degrees. Requires n to be a Null.
    • rotateZ

      public static void rotateZ(Node n, float angleDeg)
      Rotates n around the Z axis (head axis) by angleDeg degrees. Requires n to be a Null.
    • vec

      public static Vector3d vec(double x, double y, double z)
      Convenience constructor: returns new Vector3d(x, y, z).
    • pt

      public static Point3d pt(double x, double y, double z)
      Convenience constructor: returns new Point3d(x, y, z).
    • dist2D

      public static double dist2D(double x1, double y1, double x2, double y2)
      Euclidean distance between two 2-D points.
    • rad2deg

      public static double rad2deg(double rad)
      Angle in radiant to degrees conversion
    • deg2rad

      public static double deg2rad(double deg)
      Angle in degrees to radiant conversion
    • angle2D

      public static double angle2D(double x1, double y1, double x2, double y2)
      Angle (in degrees) of the vector from (x1,y1) to (x2,y2), measured counter-clockwise from the positive X axis. Result in [−180, 180].
    • dist3D

      public static double dist3D(double x1, double y1, double z1, double x2, double y2, double z2)
      Euclidean distance between two explicit 3-D points.
    • angle3D

      public static double angle3D(Vector3d a, Vector3d b)
      Angle (in degrees) between two 3-D vectors. Returns a value in [0, 180].
    • angle3D

      public static double angle3D(Tuple3d a, Tuple3d b)
      Angle (in degrees) between two 3-D tuples treated as vectors. Returns a value in [0, 180].
    • angle3D

      public static double angle3D(Node a, Node b)
      Angle (in degrees) between the growth directions of two nodes. Returns a value in [0, 180].
    • azimuth

      public static double azimuth(Node n)
      Azimuth of node n's growth direction projected onto the XY plane, measured counter-clockwise from the positive X axis. Result in [−180, 180].
    • elevation

      public static double elevation(Node n)
      Elevation angle of node n's growth direction above the XY plane. Returns a value in [−90, 90].
    • random

      public static double random(double min, double max)
      Returns a uniformly distributed pseudorandom double in [min, max].
    • randomChoice

      public static <T> T randomChoice(List<T> list)
      Returns a random element from list.
    • randomChoice

      @SafeVarargs public static <T> T randomChoice(T... items)
      Returns a random element from the given items.
    • shuffle

      public static <T> List<T> shuffle(List<T> list)
      Returns a new list with the same elements in a random order. Does not modify the input list.
    • sample

      public static <T> List<T> sample(List<T> list, int n)
      Returns a list of n distinct randomly chosen elements from list (sampling without replacement).
    • ifNull

      public static <T> T ifNull(T val, T fallback)
      Returns val if it is not null, otherwise returns fallback.
    • ifNaN

      public static double ifNaN(double val, double fallback)
      Returns val if it is not NaN, otherwise returns fallback.
    • ifNaN

      public static float ifNaN(float val, float fallback)
      Returns val if it is not NaN, otherwise returns fallback (float overload).
    • ifInf

      public static double ifInf(double val, double fallback)
      Returns val if it is finite, otherwise returns fallback.
    • histogram

      public static double[] histogram(double[] data, int bins)
      Returns an array of bins counts representing the histogram of data. The range [min(data), max(data)] is divided into equal-width bins.
    • histogramEdges

      public static double[] histogramEdges(double min, double max, int bins)
      Returns an array of bins + 1 equally spaced bin edges from min to max.
    • percentile

      public static double percentile(double[] data, double p)
      Returns the p-th percentile of data (p in [0, 100]), using linear interpolation between adjacent ranks.
    • covariance

      public static double covariance(double[] x, double[] y)
      Returns the sample covariance of x and y. Both arrays must have the same length.
    • correlation

      public static double correlation(double[] x, double[] y)
      Returns the Pearson correlation coefficient of x and y. Returns 0 if either array has zero standard deviation.
    • writematrix

      public static void writematrix(double[] matrix, String filePath)
      Writes a 1-D array to a CSV file, one value per row.
      Parameters:
      matrix - data to write
      filePath - target file path (created or overwritten)
    • writematrix

      public static void writematrix(double[][] matrix, String filePath)
      Writes a 2-D matrix to a CSV file. Each row occupies one line; columns are separated by commas.
      Parameters:
      matrix - data to write
      filePath - target file path (created or overwritten)
    • writematrix

      public static void writematrix(double[][][] matrix, String filePath)
      Writes a 3-D matrix to a CSV file. Pages (first index) are separated by a blank line; within each page, rows are written as comma-separated values — the same layout MATLAB uses when writing a 3-D array to CSV.
      Parameters:
      matrix - data to write
      filePath - target file path (created or overwritten)
    • writematrix

      public static void writematrix(int[] matrix, String filePath)
      Writes a 1-D int array to CSV (delegates to double[] variant).
    • writematrix

      public static void writematrix(int[][] matrix, String filePath)
      Writes a 2-D int matrix to CSV (delegates to double[][] variant).
    • writematrix

      public static void writematrix(float[] matrix, String filePath)
      Writes a 1-D float array to CSV (delegates to double[] variant).
    • writematrix

      public static void writematrix(float[][] matrix, String filePath)
      Writes a 2-D float matrix to CSV (delegates to double[][] variant).
    • readmatrix

      public static double[][] readmatrix(String filePath)
      Reads a CSV file and returns its contents as a double[][] matrix. Blank lines (e.g. page separators written by the 3-D variant of writematrix(double[], java.lang.String)) are skipped, so a 3-D file is read back flat as all pages concatenated. Use readmatrix3d(java.lang.String) to preserve the page structure.
      Parameters:
      filePath - path to the CSV file
      Returns:
      parsed matrix; empty array on I/O or parse error
    • readmatrix3d

      public static double[][][] readmatrix3d(String filePath)
      Reads a page-separated CSV file (written by the 3-D variant of writematrix(double[], java.lang.String)) and returns the result as a double[][][]. Pages are delimited by blank lines in the file.
      Parameters:
      filePath - path to the CSV file
      Returns:
      parsed 3-D matrix; empty array on I/O or parse error