com.kuka.geometry
Class SpatialObjectUtils

java.lang.Object
  extended by com.kuka.geometry.SpatialObjectUtils

public final class SpatialObjectUtils
extends Object

Provides utility methods for spatial objects.


Method Summary
static LoadData calculateCombinedLoadData(Frame reference, Collection<? extends SpatialObject> objects)
          Calculates the combined load data (mass, center of mass and inertia) of all given spatial objects with respect to the given reference frame (only the objects in the collection will be taken into account for the calculation, not the respective child objects).
static LoadData calculateCombinedLoadData(ObjectFrame reference)
          Calculates the load data (mass, center of mass and inertia) of all spatial objects directly or indirectly attached to the given frame's owner object.
static ObjectFrame findFirstFrame(SpatialObject owner, String name)
          Searches the first ObjectFrame with the given name in the given owner SpatialObject.
static SpatialObject findFirstObject(SpatialObject root, String name)
          Searches the first SpatialObject with the given name in the object tree below the given root SpatialObject.
static List<ObjectFrame> findFrames(SpatialObject owner, String name)
          Searches all ObjectFrame with the given name in the given owner SpatialObject.
static List<SpatialObject> findObjects(SpatialObject root, String name)
          Searches all SpatialObject with the given name in the object tree below the given root SpatialObject.
static Frame findRootFrame(Frame frame)
          Searches for the root frame.
static ObjectFrame findRootFrame(SpatialObject object)
          Searches for the root frame of the root spatial object.
static SpatialObject findRootObject(Frame frame)
          Searches the root SpatialObject in the object tree where the frame is connected to.
static boolean isRootFrame(ObjectFrame frame)
          Checks whether or not the given frame is a root frame.
static ObjectFrame tryGetFrame(SpatialObject owner, String path)
          Searches the ObjectFrame with the given path relative to the given SpatialObject.
static SpatialObject tryGetObject(SpatialObject root, String path)
          Searches the SpatialObject with the given path relative to the given SpatialObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateCombinedLoadData

public static LoadData calculateCombinedLoadData(ObjectFrame reference)
Calculates the load data (mass, center of mass and inertia) of all spatial objects directly or indirectly attached to the given frame's owner object. The resulting load data is expressed with respect to the given reference frame. The load data of the owner object of the given frame is not included in the calculation.

Parameters:
reference - a child frame of an object whose recursive children objects should be part of the calculation. Also the reference frame for the calculated load data.
Returns:
the combined load data with respect to the reference frame
Throws:
IllegalArgumentException - if the argument is null
IllegalStateException - if the relation between the involved frames could not be determined
ThreadInterruptedException - if the thread was interrupted during execution. The thread interrupt flag will be set if the thread was interrupted (that is, Thread.isInterrupted() will return true)

calculateCombinedLoadData

public static LoadData calculateCombinedLoadData(Frame reference,
                                                 Collection<? extends SpatialObject> objects)
Calculates the combined load data (mass, center of mass and inertia) of all given spatial objects with respect to the given reference frame (only the objects in the collection will be taken into account for the calculation, not the respective child objects). The root frames of all objects must have a static connection (directly or indirectly) to the given reference frame. Objects without load data (where SpatialObject.getLoadData() returns null) are ignored in the calculation.

Parameters:
reference - the reference frame for the calculated load data
objects - a collection of spatial objects that must have a static connection to the reference frame
Returns:
the combined load data with respect to the reference frame
Throws:
IllegalArgumentException - if any argument is null, or if there is no connection or an unknown connection type between the reference frame and the root frame of any of the given objects.
IllegalStateException - if the relation between the involved frames could not be determined
ThreadInterruptedException - if the thread was interrupted during execution. The thread interrupt flag will be set if the thread was interrupted (that is, Thread.isInterrupted() will return true)

findRootObject

public static SpatialObject findRootObject(Frame frame)
Searches the root SpatialObject in the object tree where the frame is connected to.

Parameters:
frame - the Frame to start from
Returns:
the root SpatialObject of the frame. If the frame is not connected to any SpatialObject in its parents then null is returned.
Throws:
IllegalArgumentException - if the given object is null

findRootFrame

public static ObjectFrame findRootFrame(SpatialObject object)
Searches for the root frame of the root spatial object.

Parameters:
object - the spatial object to start from
Returns:
the root frame of the root spatial object
Throws:
IllegalArgumentException - if the given object is null

findRootFrame

public static Frame findRootFrame(Frame frame)
Searches for the root frame.

Parameters:
frame - the frame to start from
Returns:
the root frame of the given frame
Throws:
IllegalArgumentException - if the given frame is null

tryGetObject

public static SpatialObject tryGetObject(SpatialObject root,
                                         String path)
Searches the SpatialObject with the given path relative to the given SpatialObject.

Parameters:
root - the SpatialObject to start the search from
path - the path to search for
Returns:
the SpatialObject with the given path. If it does not exist, null is returned.
Throws:
IllegalArgumentException - if either root or path is null

findObjects

public static List<SpatialObject> findObjects(SpatialObject root,
                                              String name)
Searches all SpatialObject with the given name in the object tree below the given root SpatialObject.

Parameters:
root - the SpatialObject to start the search from
name - the name to search for
Returns:
All SpatialObject with the given name below the given root SpatialObject
Throws:
IllegalArgumentException - if either root or name is null

findFirstObject

public static SpatialObject findFirstObject(SpatialObject root,
                                            String name)
Searches the first SpatialObject with the given name in the object tree below the given root SpatialObject. If multiple objects with the same name exists, any of these could be returned.

Parameters:
root - the SpatialObject to start the search from
name - the name to search for
Returns:
The first SpatialObject with the given name below the given root SpatialObject. If it does not exist, null is returned.
Throws:
IllegalArgumentException - if either root or name is null

tryGetFrame

public static ObjectFrame tryGetFrame(SpatialObject owner,
                                      String path)
Searches the ObjectFrame with the given path relative to the given SpatialObject.

Parameters:
owner - the SpatialObject owning the frame
path - the path to search for
Returns:
the ObjectFrame with the given path. If it does not exist, null is returned.
Throws:
IllegalArgumentException - if either owner or path is null

findFrames

public static List<ObjectFrame> findFrames(SpatialObject owner,
                                           String name)
Searches all ObjectFrame with the given name in the given owner SpatialObject.

Parameters:
owner - the SpatialObject to search in
name - the name to search for
Returns:
all ObjectFrame with the given name in the given owner SpatialObject
Throws:
IllegalArgumentException - if either owner or name is null

findFirstFrame

public static ObjectFrame findFirstFrame(SpatialObject owner,
                                         String name)
Searches the first ObjectFrame with the given name in the given owner SpatialObject. If multiple frames with the same name exists, any of these could be returned.

Parameters:
owner - the SpatialObject to search in
name - the name to search for
Returns:
the first ObjectFrame with the given name in the given owner SpatialObject. If it does not exist, null is returned.
Throws:
IllegalArgumentException - if either owner or name is null

isRootFrame

public static boolean isRootFrame(ObjectFrame frame)
Checks whether or not the given frame is a root frame.

Parameters:
frame - the frame to be checked
Returns:
whether or not the given frame is a root frame


Copyright © 2019. All rights reserved.