Class ROTOR
java.lang.Object
com.github.gbenroscience.math.geom.ROTOR
Create a variable or use a constant for the angle Create matrix vectors for O
and D Where O is the origin or point about which rotation will occur, and D
are the direction coordinates(a,b,c) of the rotation
rot(F,angle,origin,direction)
So: rot(@(x,y,z)sin(x-y-3*z),PI,@(2,1)(2,2),@(3,1)(1,-2,3))
rot(@(x,y,z)sin(x-y-3*z),PI,@(2,1)(2,2),@(3,1)(1,-2,3))
- Author:
- GBEMIRO
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new object of class ROTOR that can be used to rotate Point objects, Line objects, and Plane objects, Function objects and so on.Creates a new object of class ROTOR that can be used to rotate Point objects, Line objects, and Plane objects, Function objects and so on. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAngle()String[]The direction indices of rotation.static voidstatic voidstatic PointplanarXYRotate(Point p, Point cen, double angle) Method for rotating a Point object in the XY plane or in any plane parallel to the XY plane.CARE!!! The developer makes no guarantees about what will happen if an invalid function string is passed to this method.static LinerotateLine(Line line, double ang, Point p) static PolygonrotatePolygon(Polygon p, Point orbitalCenter, double angle) static PolygonrotateRectangle(Rectangle rect, Point orbitalCenter, double angle) Rotates a Rectangle object.voidsetAngle(double angle) voidsetDirection(Direction direction) The direction indices of rotation.voidsetRotorCenter(Point rotorCenter) voidsetXAxisName(String name) voidsetYAxisName(String name) voidsetZAxisName(String name) toString()static PointConverts a point in the Java screen coordinates xy plane to one in the mathematical xy plane by rotating the point through PI radians in the direction of the yz planestatic PointConverts a point in the mathematical xy plane to one in the Java screen coordinates xy plane by rotating the point through PI radians in the direction of the yz plane
-
Constructor Details
-
ROTOR
Creates a new object of class ROTOR that can be used to rotate Point objects, Line objects, and Plane objects, Function objects and so on. This constructor defaults the rotor center, i.e the point about which the rotation will occur to zero.- Parameters:
angle- The angle of rotationdirection- The direction in which rotation will occur. When rotation occurs, for a Point object, it occurs in a single plane whose direction vector or direction indices dictate or specify the direction of rotation. For a Line object, it occurs in a multitude of parallel planes which being parallel will have a common direction vector. This direction vector specifies the direction of rotation.
-
ROTOR
Creates a new object of class ROTOR that can be used to rotate Point objects, Line objects, and Plane objects, Function objects and so on.- Parameters:
angle- The angle of rotationrotorCenter- The Point object about which the rotation will occur.direction- The direction in which rotation will occur. When rotation occurs, for a Point object, it occurs in a single plane whose direction vector or direction indices dictate or specify the direction of rotation. For a Line object, it occurs in a multitude of parallel planes which being parallel will have a common direction vector. This direction vector specifies the direction of rotation.
-
-
Method Details
-
getAngle
public double getAngle()- Returns:
- the angle of rotation of the object
-
setAngle
public void setAngle(double angle) - Parameters:
angle- sets the angle of rotation
-
setDirection
The direction indices of rotation. e.g if a body is to be rotated in such a way that a particular point on it will always move in the plane 2x+3y+4z+45=23 Then the direction indices of rotation are 2,3,4. They are stored in a point object.- Parameters:
direction- sets the direction indices of rotation These are very important and must be supplied correctly to the system.
-
getDirection
The direction indices of rotation. e.g if a body is to be rotated in such a way that a particular point on it will always move in the plane 2x+3y+4z+45=23 Then the direction indices of rotation are 2,3,4. They are stored in a point object. These are very important and must be supplied correctly to the system.- Returns:
- the direction indices of rotation
-
getRotorCenter
- Returns:
- the coordinates of the point about which rotation occurs.
-
setXAxisName
- Parameters:
name- sets the name of the x axis. The default is x.
-
setYAxisName
- Parameters:
name- sets the name of the y axis. The default is y.
-
setZAxisName
- Parameters:
name- sets the name of the z axis. The default is z.
-
getCoordinateAxesName
- Returns:
- an array containing the names of all the 3 axes.
-
setRotorCenter
- Parameters:
rotorCenter- sets the coordinates of the point about which rotation occurs.
-
planarXYRotate
Method for rotating a Point object in the XY plane or in any plane parallel to the XY plane. The Point object to be rotated and the one about which it is rotating must have the same Z coordinates.- Parameters:
p- a Point object in the xy plane The z coordinates of both Point objects must be either the same or must both be zero.cen- a Point object about which the rotation of the first Point object will occur.angle- the angle of rotation- Returns:
- a Point object in the xy plane rotated through the angle
-
rotate
- Parameters:
p- The Point object to be rotated.- Returns:
- a Point object that is the new Point object obtained by rotating the Point object parameter through the angle attribute of this ROTOR object and about the Point attribute of this class, i.e (rotorCenter) and also in the given direction.
-
rotate
- Parameters:
line- The Line3D object to be rotated.- Returns:
- a Line3D object that is the new Line3D object obtained by rotating the Line3D object parameter through the angle attribute of this ROTOR object and about the Point attribute of this class, i.e (rotorCenter) and also in the given direction.
-
rotate
- Parameters:
plane- The Plane object to be rotated.- Returns:
- a Plane object that is the new Plane object obtained by rotating the Plane object parameter through the angle attribute of this ROTOR object and about the Point attribute of this class, i.e (rotorCenter) and also in the given direction.
-
toString
-
rotate
CARE!!! The developer makes no guarantees about what will happen if an invalid function string is passed to this method. This method only works with valid functions that use the names assigned to the coordinate axes(default is x,y,z). Wherever they occur as variables in the expression, they MUST BE ENCLOSED IN CIRCULAR BRACKETS!!! THE VARIABLE NAMES MUST BE SINGLE ALPHABET CHARACTERS ONLY!!!!. No parser or expression analyzer is used before rotating this function, so be warned. IF YOUR FUNCTION WILL CONTAIN METHOD NAMES OR INBUILT FUNCTIONS THAT ARE NOT LISTED IN THEARRAY, ADD THEM TO THAT ARRAYinvalid reference
ROTOR#METHODS- Parameters:
function- the function string to be rotated.- Returns:
- the rotated function.
-
transformMathCoordsToJavaCoords
Converts a point in the mathematical xy plane to one in the Java screen coordinates xy plane by rotating the point through PI radians in the direction of the yz plane- Parameters:
point- a Point object in the mathematical xy plane- Returns:
- a Point object in the Java screen xy plane.
-
transformJavaCoordsToMathCoords
Converts a point in the Java screen coordinates xy plane to one in the mathematical xy plane by rotating the point through PI radians in the direction of the yz plane- Parameters:
point- a Point object in the Java screen xy plane.- Returns:
- a Point object in the mathematical xy plane.
-
rotateLine
-
rotateRectangle
Rotates a Rectangle object.- Parameters:
rect- The Rectangle object to be rotated.orbitalCenter- The point about which rotation will occur.angle- The angle of rotation.- Returns:
- a Polygon object being the product of rotation of the Rectangle object.
-
rotatePolygon
-
main
-
main1
-