Class LineIntersector

    • Field Detail

      • terrain

        protected Terrain terrain
      • numThreads

        protected int numThreads
      • referencePosition

        protected Position referencePosition
      • positions

        protected java.lang.Iterable<Position> positions
      • numPositions

        protected int numPositions
      • referencePoint

        protected Vec4 referencePoint
      • threadPool

        protected java.util.concurrent.ThreadPoolExecutor threadPool
      • numProcessedPositions

        protected java.util.concurrent.atomic.AtomicInteger numProcessedPositions
      • startTime

        protected long startTime
      • endTime

        protected long endTime
      • allIntersections

        protected java.util.Map<Position,​java.util.List<Intersection>> allIntersections
    • Constructor Detail

      • LineIntersector

        protected LineIntersector​(Terrain terrain,
                                  int numThreads)
    • Method Detail

      • doPerformIntersection

        protected abstract void doPerformIntersection​(Position position)
                                               throws java.lang.InterruptedException
        Called to execute an intersection test for one position.
        Parameters:
        position - the position to test.
        Throws:
        java.lang.InterruptedException - if the operation is interrupted.s
      • getTerrain

        public Terrain getTerrain()
      • getNumThreads

        public int getNumThreads()
      • getReferencePosition

        public Position getReferencePosition()
      • setReferencePosition

        public void setReferencePosition​(Position referencePosition)
        Sets the origin of the lines to intersect.
        Parameters:
        referencePosition - the origin to use for all lines.
      • getPositions

        public java.lang.Iterable<Position> getPositions()
      • setPositions

        public void setPositions​(java.lang.Iterable<Position> positions)
        Specifies the end positions of all lines to intersect. Intersection tests are performed for each position, using the position as the line's end and the current reference position as the line's origin.
        Parameters:
        positions - the positions.
      • getStartTime

        public long getStartTime()
      • getEndTime

        public long getEndTime()
      • getNumProcessedPositions

        public int getNumProcessedPositions()
      • getAllIntersections

        public java.util.Map<Position,​java.util.List<Intersection>> getAllIntersections()
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • performIntersection

        protected void performIntersection​(Position position)
                                    throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException