Class MeshComponent

java.lang.Object
org.jlab.geom.abs.MeshComponent
All Implemented Interfaces:
Component, Transformable, Showable
Direct Known Subclasses:
ScintillatorMesh

public class MeshComponent extends Object implements Component
Author:
gavalian
  • Constructor Details Link icon

    • MeshComponent Link icon

      public MeshComponent(int id)
  • Method Details Link icon

    • getComponentId Link icon

      public int getComponentId()
      Description copied from interface: Component
      Returns the component's id number.
      Specified by:
      getComponentId in interface Component
      Returns:
      the id
    • getNumVolumePoints Link icon

      public int getNumVolumePoints()
      Description copied from interface: Component
      Returns the number of points that define the volume.
      Specified by:
      getNumVolumePoints in interface Component
      Returns:
      the number of volume points
    • getVolumePoint Link icon

      public Point3D getVolumePoint(int p)
      Description copied from interface: Component
      Returns the point on the volume with the specified index.
      Specified by:
      getVolumePoint in interface Component
      Parameters:
      p - the index of the point
      Returns:
      the point on the volume
    • getNumVolumeEdges Link icon

      public int getNumVolumeEdges()
      Description copied from interface: Component
      Returns the number of edges between the points that define the volume.
      Specified by:
      getNumVolumeEdges in interface Component
      Returns:
      the number of volume edges
    • getVolumeEdge Link icon

      public Line3D getVolumeEdge(int e)
      Description copied from interface: Component
      Returns the edge on the volume with the specified index.

      Though edges are returned as Line3D objects 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 returned Line3D is 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:
      getVolumeEdge in interface Component
      Parameters:
      e - the index of the edge
      Returns:
      the edge on the volume
    • getVolumeShape Link icon

      public Shape3D getVolumeShape()
      Description copied from interface: Component
      Returns the volume of the component.

      A volume is represented by a Shape3D object which contains a list of triangular Face3D objects. This these triangles bound a closed closed volume.

      Specified by:
      getVolumeShape in interface Component
      Returns:
      the volume
    • getVolumeCrossSection Link icon

      public List<Line3D> getVolumeCrossSection(Transformation3D transformation)
      Description copied from interface: Component
      Returns the cross section of a plane through the the component's volume as a list of lines in the xy-plane.

      This method takes a Transformation3D object as an argument, then constructs a new Plane3D object 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:
      getVolumeCrossSection in interface Component
      Parameters:
      transformation - the transformation to apply to the plane
      Returns:
      a list of lines in the xy-plane representing the cross section
    • getVolumeIntersection Link icon

      public boolean getVolumeIntersection(Line3D line, Point3D inIntersect, Point3D outIntersect)
      Description copied from interface: Component
      Returns true if the given line segment intersect the volume-shape twice (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:
      getVolumeIntersection in interface Component
      Parameters:
      line - the line segment
      inIntersect - the incoming intersection
      outIntersect - the outgoing intersection
      Returns:
      true if two intersections are found
    • getMidpoint Link icon

      public Point3D getMidpoint()
      Description copied from interface: Component
      Returns 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:
      getMidpoint in interface Component
      Returns:
      the midpoint
    • getLength Link icon

      public double getLength()
      Description copied from interface: Component
      Returns the length of this component.
      Specified by:
      getLength in interface Component
      Returns:
      the length
    • getLineX Link icon

      public Line3D getLineX()
    • getLineY Link icon

      public Line3D getLineY()
    • getLineZ Link icon

      public Line3D getLineZ()
    • getType Link icon

      public String getType()
      Description copied from interface: Component
      Returns a string that identifies the specific subtype of this component.
      Specified by:
      getType in interface Component
      Returns:
      a string naming this component's type
    • show Link icon

      public void show()
      Description copied from interface: Component
      Invokes System.out.println(this).
      Specified by:
      show in interface Component
      Specified by:
      show in interface Showable
    • translateXYZ Link icon

      public void translateXYZ(double dx, double dy, double dz)
      Description copied from interface: Transformable
      Translates this object linearly by the amounts specified.
      Specified by:
      translateXYZ in interface Transformable
      Parameters:
      dx - amount to translate along the x axis
      dy - amount to translate along the y axis
      dz - amount to translate along the z axis
    • rotateX Link icon

      public void rotateX(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the x axis.
      Specified by:
      rotateX in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • rotateY Link icon

      public void rotateY(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the y axis.
      Specified by:
      rotateY in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • rotateZ Link icon

      public void rotateZ(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the z axis.
      Specified by:
      rotateZ in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • getVolumeMesh Link icon

      public Mesh3D getVolumeMesh()
    • init Link icon

      public void init(String type, double... pars)