Class MeshComponent
- All Implemented Interfaces:
Component, Transformable, Showable
- Direct Known Subclasses:
ScintillatorMesh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the component's id number.doubleReturns the length of this component.getLineX()getLineY()getLineZ()Returns the midpoint of this component.intReturns the number of edges between the points that define thevolume.intReturns the number of points that define thevolume.getType()Returns a string that identifies the specific subtype of this component.getVolumeCrossSection(Transformation3D transformation) Returns the cross section of a plane through the the component'svolumeas a list of lines in the xy-plane.getVolumeEdge(int e) Returns the edge on thevolumewith the specified index.booleangetVolumeIntersection(Line3D line, Point3D inIntersect, Point3D outIntersect) Returns true if the given line segment intersect thevolume-shapetwice (one incoming intersection and one out going) and stores the incoming and outgoing intersection points are stored in the first and second Point3D objects given as arguments respectively.getVolumePoint(int p) Returns the point on thevolumewith the specified index.Returns the volume of the component.voidvoidrotateX(double angle) Rotates this object clockwise around the x axis.voidrotateY(double angle) Rotates this object clockwise around the y axis.voidrotateZ(double angle) Rotates this object clockwise around the z axis.voidshow()InvokesSystem.out.println(this).voidtranslateXYZ(double dx, double dy, double dz) Translates this object linearly by the amounts specified.
-
Constructor Details
-
MeshComponent
public MeshComponent(int id)
-
-
Method Details
-
getComponentId
public int getComponentId()Description copied from interface:ComponentReturns the component's id number.- Specified by:
getComponentIdin interfaceComponent- Returns:
- the id
-
getNumVolumePoints
public int getNumVolumePoints()Description copied from interface:ComponentReturns the number of points that define thevolume.- Specified by:
getNumVolumePointsin interfaceComponent- Returns:
- the number of volume points
-
getVolumePoint
Description copied from interface:ComponentReturns the point on thevolumewith the specified index.- Specified by:
getVolumePointin interfaceComponent- Parameters:
p- the index of the point- Returns:
- the point on the volume
-
getNumVolumeEdges
public int getNumVolumeEdges()Description copied from interface:ComponentReturns the number of edges between the points that define thevolume.- Specified by:
getNumVolumeEdgesin interfaceComponent- Returns:
- the number of volume edges
-
getVolumeEdge
Description copied from interface:ComponentReturns the edge on thevolumewith the specified index.Though edges are returned as
Line3Dobjects and a majority components have edges which are all straight line segments, edges are not required to be straight lines. The edge may, in reality, be curved, in which case the returnedLine3Dis merely storing the two points bounding a curved path segment. Thus, special care must be taken to ensure that the edge is in fact a straight line segment if one intends to use it as such.- Specified by:
getVolumeEdgein interfaceComponent- Parameters:
e- the index of the edge- Returns:
- the edge on the volume
-
getVolumeShape
Description copied from interface:ComponentReturns the volume of the component.A volume is represented by a
Shape3Dobject which contains a list of triangularFace3Dobjects. This these triangles bound a closed closed volume.- Specified by:
getVolumeShapein interfaceComponent- Returns:
- the volume
-
getVolumeCrossSection
Description copied from interface:ComponentReturns the cross section of a plane through the the component'svolumeas a list of lines in the xy-plane.This method takes a Transformation3D object as an argument, then constructs a new
Plane3Dobject in the xy-plane and applies the transformation to the plane. The intersection of the volume's shape with the transformed plane is then calculated and stored in a list of lines. The inverse of the transformation is then applied to each line in the list ensuring that each line in the returned list is in the xy-plane.- Specified by:
getVolumeCrossSectionin interfaceComponent- Parameters:
transformation- the transformation to apply to the plane- Returns:
- a list of lines in the xy-plane representing the cross section
-
getVolumeIntersection
Description copied from interface:ComponentReturns true if the given line segment intersect thevolume-shapetwice (one incoming intersection and one out going) and stores the incoming and outgoing intersection points are stored in the first and second Point3D objects given as arguments respectively.The incoming intersection is defined such that the incoming intersection point is closer to the origin of the line than the outgoing intersection point.
- Specified by:
getVolumeIntersectionin interfaceComponent- Parameters:
line- the line segmentinIntersect- the incoming intersectionoutIntersect- the outgoing intersection- Returns:
- true if two intersections are found
-
getMidpoint
Description copied from interface:ComponentReturns the midpoint of this component. By convention, the midpoint of a component is normally the geometric center of the component's volume but the definition of midpoint may vary by component type.- Specified by:
getMidpointin interfaceComponent- Returns:
- the midpoint
-
getLength
-
getLineX
-
getLineY
-
getLineZ
-
getType
-
show
-
translateXYZ
public void translateXYZ(double dx, double dy, double dz) Description copied from interface:TransformableTranslates this object linearly by the amounts specified.- Specified by:
translateXYZin interfaceTransformable- Parameters:
dx- amount to translate along the x axisdy- amount to translate along the y axisdz- amount to translate along the z axis
-
rotateX
public void rotateX(double angle) Description copied from interface:TransformableRotates this object clockwise around the x axis.- Specified by:
rotateXin interfaceTransformable- Parameters:
angle- rotation angle in radians
-
rotateY
public void rotateY(double angle) Description copied from interface:TransformableRotates this object clockwise around the y axis.- Specified by:
rotateYin interfaceTransformable- Parameters:
angle- rotation angle in radians
-
rotateZ
public void rotateZ(double angle) Description copied from interface:TransformableRotates this object clockwise around the z axis.- Specified by:
rotateZin interfaceTransformable- Parameters:
angle- rotation angle in radians
-
getVolumeMesh
-
init
-