Package algorithm
Class Tool
java.lang.Object
algorithm.Tool
The class Tool represents the name of a tool,
its respective measurements and the visualisation.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMeasurement
(Measurement measurement) Adds a measurement to the listvoid
addVisualizationToRoot
(javafx.scene.Group root) Helper method for adding the projection and the cone to the visualisation groupvoid
checkBounds
(ArrayList<STLModel> stlModels) Checks for collision and changes tracker color accordingly Color red implies a collision with the model was detected Color green implies no collision was detectedvoid
Method to check if the projection intersects a target and if so, change the color of the target Color red implies an intersection between the projection and the target Color green implies no intersection was detectedboolean
Return if cone is visibleThis method computes the mean of the passed values.This method computes the average rotation.This method calculates errors and saves them in a list.Returns a list of measurementsgetName()
Returns the name of the toolThis method computes the Jitter of a Rotation.void
init()
Method to initialize the attributes of the toolvoid
void
printPos()
Helper method to print the current positionboolean
Return if projection is visiblevoid
setConeColor
(javafx.scene.paint.PhongMaterial color) Method to set the color of the conevoid
setConeSize
(double size) Method to set the size of the conevoid
setConeVisibility
(boolean visibility) Method to set the visibility of the conevoid
Sets the name of the toolvoid
setProjectionVisibility
(boolean visibility) Method to set the visibility of the projectionvoid
setTargets
(LinkedList<Target> targets) Set the targets of the toolvoid
show()
Method to update the current position of the tool and perform all necessary transformations on it
-
Constructor Details
-
Tool
-
Tool
public Tool()
-
-
Method Details
-
init
public void init()Method to initialize the attributes of the tool -
loadTransformationMatrix
public void loadTransformationMatrix() -
show
public void show()Method to update the current position of the tool and perform all necessary transformations on it -
addVisualizationToRoot
public void addVisualizationToRoot(javafx.scene.Group root) Helper method for adding the projection and the cone to the visualisation group- Parameters:
root
-
-
setTargets
Set the targets of the tool- Parameters:
targets
- the new targets
-
checkTargets
public void checkTargets()Method to check if the projection intersects a target and if so, change the color of the target Color red implies an intersection between the projection and the target Color green implies no intersection was detected -
checkBounds
Checks for collision and changes tracker color accordingly Color red implies a collision with the model was detected Color green implies no collision was detected -
setConeColor
public void setConeColor(javafx.scene.paint.PhongMaterial color) Method to set the color of the cone- Parameters:
color
- the new cone color
-
setConeSize
public void setConeSize(double size) Method to set the size of the cone- Parameters:
size
- the new cone size
-
setConeVisibility
public void setConeVisibility(boolean visibility) Method to set the visibility of the cone- Parameters:
visibility
- boolean, true if visible
-
coneIsVisible
public boolean coneIsVisible()Return if cone is visible- Returns:
- true if cone is visible
-
setProjectionVisibility
public void setProjectionVisibility(boolean visibility) Method to set the visibility of the projection- Parameters:
visibility
- boolean, true if visible
-
projectionIsVisible
public boolean projectionIsVisible()Return if projection is visible- Returns:
- true if projection is visible
-
getName
Returns the name of the tool- Returns:
- name of the tool
-
setName
Sets the name of the tool- Parameters:
name
- new name of the tool
-
getMeasurement
Returns a list of measurements- Returns:
- List containing all the measurements of the tools
-
addMeasurement
Adds a measurement to the list- Parameters:
measurement
- measurement to be added
-
getErrors
This method calculates errors and saves them in a list. With a loop the distance between each point and the average point is computed. Every distance is added to the list of errors.- Parameters:
avgPoint
- - average point of type Point3D- Returns:
- errors - of type list
-
getAverageMeasurement
This method computes the mean of the passed values. getAverageMeasurement gets a list of measurements. Size of the list is determined. A null point is created. A loop goes over the number of measurements. In place i the point will be fetched and added to addPoint. For x, y and z an average point is calculated. Though all points from addPoint are pitched by the size of the list. An average measurement and an average point is created.- Returns:
- averageMeasurement - a average measurement
-
getAverageRotation
This method computes the average rotation. The first quaternion of the list of measurement on point 0 and the last quaternion is taken. The time and the size of the measurements are divided. At this value, the movement is exactly the average. On the first quaterion method slerp is called by class quaternion. The first and the last quaternion plus positionAtTime is returned as average rotation.- Returns:
- firstRotation.slerp(firstRotation, lastRotation, positionAtTime) - a quaternion
-
getRotationJitter
This method computes the Jitter of a Rotation. A list of measurements and an average rotation is passed. Four lists of errors, for every value of the quaternion, where created. In a loop the method gets quaternions on point i. If i > 0, from rotationMovement the quaternion on point i is subtracted. Error variables are created. From each quaternion the list from above is added. Every list is added in rotationError. From rotation error the root mean square error is calculated.- Returns:
- rotationError - of type quaternion
-
printPos
public void printPos()Helper method to print the current position
-