Class ParticleGroup

  • All Implemented Interfaces:
    com.badlogic.gdx.utils.Disposable, IObserver, I3DTextRenderable, IRenderable, IFocus, IStarContainer, IPosition
    Direct Known Subclasses:
    StarGroup

    public class ParticleGroup
    extends FadeNode
    implements I3DTextRenderable, IFocus, IObserver
    This class represents a vgroup of non-focusable particles, all with the same luminosity. The contents of this vgroup will be sent once to GPU memory and stay there, so all particles get rendered directly in the GPU from the GPU with no CPU intervention. This allows for much faster rendering. Use this for large groups of particles.
    • Field Detail

      • pointData

        protected com.badlogic.gdx.utils.Array<? extends ParticleGroup.ParticleBean> pointData
        List that contains the point data. It contains only [x y z]
      • provider

        protected java.lang.String provider
        Fully qualified name of data provider class
      • datafile

        protected java.lang.String datafile
        Path of data file
      • profileDecay

        public float profileDecay
        Profile decay of the particles in the shader
      • colorNoise

        public float colorNoise
        Noise factor for the color in [0,1]
      • inGpu

        public boolean inGpu
        Are the data of this vgroup in the GPU memory?
      • offset

        public int offset
      • count

        public int count
      • fixedMeanPosition

        protected boolean fixedMeanPosition
        This flag indicates whether the mean position is already given by the JSON injector
      • factor

        protected java.lang.Double factor
        Factor to apply to the data points, usually to normalise distances
      • ccMin

        protected float[] ccMin
        Mapping colors
      • ccMax

        protected float[] ccMax
        Mapping colors
      • lastSortTime

        protected long lastSortTime
        Stores the time when the last sort operation finished, in ms
      • meanDistance

        protected double meanDistance
        The mean distance from the origin of all points in this group. Gives a sense of the scale.
      • maxDistance

        protected double maxDistance
      • minDistance

        protected double minDistance
      • disposed

        public boolean disposed
    • Constructor Detail

      • ParticleGroup

        public ParticleGroup()
    • Method Detail

      • doneLoading

        public void doneLoading​(com.badlogic.gdx.assets.AssetManager manager)
        Overrides:
        doneLoading in class FadeNode
      • data

        public com.badlogic.gdx.utils.Array<? extends ParticleGroup.ParticleBean> data()
        Returns the data list
        Returns:
        The data list
      • computeGeomCentre

        public Vector3d computeGeomCentre()
        Computes the geometric centre of this data cloud
      • computeGeomCentre

        public Vector3d computeGeomCentre​(boolean forceRecompute)
        Computes the geometric centre of this data cloud
        Parameters:
        forceRecompute - Recomputes the geometric centre even if it has been already computed
      • size

        public int size()
        Number of objects of this vgroup
        Returns:
        The number of objects
      • updateFocus

        public void updateFocus​(ITimeFrameProvider time,
                                ICamera camera)
        Updates the parameters of the focus, if the focus is active in this vgroup
        Parameters:
        time - The time frame provider
        camera - The current camera
      • addToRenderLists

        protected void addToRenderLists​(ICamera camera)
        Description copied from class: AbstractPositionEntity
        Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.
        Overrides:
        addToRenderLists in class FadeNode
      • getProvider

        public java.lang.String getProvider()
        LABEL
      • setProvider

        public void setProvider​(java.lang.String provider)
      • setDatafile

        public void setDatafile​(java.lang.String datafile)
      • renderText

        public boolean renderText()
        Description copied from interface: I3DTextRenderable
        Tells whether the text must be rendered or not for this entity
        Specified by:
        renderText in interface I3DTextRenderable
        Returns:
        True if text must be rendered
      • textColour

        public float[] textColour()
        Description copied from interface: I3DTextRenderable
        Returns an array with the text colour in the fashion [r, g, b, a]
        Specified by:
        textColour in interface I3DTextRenderable
        Returns:
        Array with the colour
      • textScale

        public float textScale()
        Description copied from interface: I3DTextRenderable
        Returns the text scale for the scale varying in the shader
        Specified by:
        textScale in interface I3DTextRenderable
        Returns:
        The scale
      • isLabel

        public boolean isLabel()
        Description copied from interface: I3DTextRenderable
        Is it a label or another kind of text?
        Specified by:
        isLabel in interface I3DTextRenderable
        Returns:
        Whether this is a label
      • setFactor

        public void setFactor​(java.lang.Double factor)
      • setProfiledecay

        public void setProfiledecay​(java.lang.Double profiledecay)
      • setColornoise

        public void setColornoise​(java.lang.Double colorNoise)
      • getFocusSize

        public double getFocusSize()
        Default size if not in data, 1e5 km
        Returns:
        The size
      • getName

        public java.lang.String getName()
        Returns name of focus
        Specified by:
        getName in interface IFocus
        Overrides:
        getName in class SceneGraphNode
        Returns:
        The name
      • isActive

        public boolean isActive()
        Description copied from interface: IFocus
        Returns whether this focus object is active or not. Useful for particle groups
        Specified by:
        isActive in interface IFocus
        Returns:
        The active status
      • setPosition

        public void setPosition​(double[] pos)
        Returns position of focus
        Overrides:
        setPosition in class FadeNode
      • addFocusableObjects

        public void addFocusableObjects​(com.badlogic.gdx.utils.Array<IFocus> list)
        Adds all the children that are focusable objects to the list.
        Overrides:
        addFocusableObjects in class SceneGraphNode
        Parameters:
        list -
      • getAbsolutePosition

        public Vector3d getAbsolutePosition​(java.lang.String name,
                                            Vector3d out)
        Description copied from interface: IFocus
        Returns the absolute position of the entity identified by name within this entity in the native reference system
        Specified by:
        getAbsolutePosition in interface IFocus
        Overrides:
        getAbsolutePosition in class AbstractPositionEntity
        Parameters:
        name - The name (lowercase) of the entity to get the position from (useful in case of star groups)
        out - Vector3d to put the return value
        Returns:
        The absolute position of the entity if it exists, null otherwise
      • getPredictedPosition

        public Vector3d getPredictedPosition​(Vector3d aux,
                                             ITimeFrameProvider time,
                                             ICamera camera,
                                             boolean force)
        Description copied from class: AbstractPositionEntity
        Gets the position of this entity in the next time step in the internal reference system using the given time provider and the given camera.
        Specified by:
        getPredictedPosition in interface IFocus
        Overrides:
        getPredictedPosition in class AbstractPositionEntity
        Parameters:
        aux - The out vector where the result will be stored.
        time - The time frame provider.
        camera - The camera.
        force - Whether to force the computation if time is off.
        Returns:
        The aux vector for chaining.
      • getAppmag

        public float getAppmag()
        Description copied from interface: IFocus
        Gets the apparent magnitude
        Specified by:
        getAppmag in interface IFocus
        Returns:
        The apparent magnitude
      • getAbsmag

        public float getAbsmag()
        Description copied from interface: IFocus
        Gets the absolute magnitude
        Specified by:
        getAbsmag in interface IFocus
        Returns:
        The absolute magnitude
      • getSize

        public double getSize​(int i)
        Returns the size of the particle at index i
        Parameters:
        i - The index
        Returns:
        The size
      • getRadius

        public double getRadius​(int i)
      • withinMagLimit

        public boolean withinMagLimit()
        Description copied from interface: IFocus
        Returns true if the focus is within the magnitude limit defined in GlobalConf
        Specified by:
        withinMagLimit in interface IFocus
        Returns:
        True if focus within magnitude limit
      • getRotationComponent

        public RotationComponent getRotationComponent()
        Description copied from interface: IFocus
        Returns the rotation component of this focus
        Specified by:
        getRotationComponent in interface IFocus
        Returns:
        The rotation component. Can be null
      • getOrientationQuaternion

        public Quaterniond getOrientationQuaternion()
        Description copied from interface: IFocus
        Returns the orientation quaternion of this focus
        Specified by:
        getOrientationQuaternion in interface IFocus
        Returns:
        The orientation quaternion. Can be null
      • getColor

        public float[] getColor()
      • highlightedSizeFactor

        public float highlightedSizeFactor()
      • addHit

        public void addHit​(int screenX,
                           int screenY,
                           int w,
                           int h,
                           int pxdist,
                           NaturalCamera camera,
                           com.badlogic.gdx.utils.Array<IFocus> hits)
        Description copied from interface: IFocus
        Adds this focus to the hits list if it is hit by the [screenX, screenY] position
        Specified by:
        addHit in interface IFocus
        Parameters:
        screenX - The x position of the hit
        screenY - The y position of the hit
        w - The viewport width
        h - The viewport height
        pxdist - The minimum pixel distance to consider as hit
        camera - The camera
        hits - The list where to add the element
      • addHit

        public void addHit​(Vector3d p0,
                           Vector3d p1,
                           NaturalCamera camera,
                           com.badlogic.gdx.utils.Array<IFocus> hits)
        Description copied from interface: IFocus
        Adds this focus to the hits list if it is hit by the given ray
        Specified by:
        addHit in interface IFocus
        Parameters:
        p0 - Start point of the ray
        p1 - End point of the ray
        camera - The camera
        hits - The list where the focus is to be added
      • notify

        public void notify​(Events event,
                           java.lang.Object... data)
        Specified by:
        notify in interface IObserver
      • setFocusIndex

        public void setFocusIndex​(int index)
      • makeFocus

        public void makeFocus()
        Description copied from interface: IFocus
        Hook that runs when the candidate is actually made focus
        Specified by:
        makeFocus in interface IFocus
      • getCandidateIndex

        public int getCandidateIndex()
      • getCandidateId

        public long getCandidateId()
        Description copied from interface: IFocus
        Returns the id of the focus candidate of this object. Defaults to IFocus.getId()
        Specified by:
        getCandidateId in interface IFocus
        Returns:
        The id of the candidate
      • getCandidateName

        public java.lang.String getCandidateName()
        Description copied from interface: IFocus
        Returns the name of the focus candidate of this object. Defaults to IFocus.getName()
        Specified by:
        getCandidateName in interface IFocus
        Returns:
        The name of the candidate
      • getCandidateViewAngleApparent

        public double getCandidateViewAngleApparent()
        Description copied from interface: IFocus
        Returns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians
        Specified by:
        getCandidateViewAngleApparent in interface IFocus
        Returns:
        The apparent view angle in radians
      • getFocus

        public IFocus getFocus​(java.lang.String name)
        Description copied from interface: IFocus
        Prepares the candidate with the given name
        Specified by:
        getFocus in interface IFocus
        Parameters:
        name - The name in lower case
      • getAlpha

        public double getAlpha()
        Description copied from interface: IFocus
        Returns the right ascension angle of this focus object
        Specified by:
        getAlpha in interface IFocus
        Overrides:
        getAlpha in class AbstractPositionEntity
        Returns:
        The right ascension angle in degrees
      • getDelta

        public double getDelta()
        Description copied from interface: IFocus
        Returns the declination angle of this focus object
        Specified by:
        getDelta in interface IFocus
        Overrides:
        getDelta in class AbstractPositionEntity
        Returns:
        The declination angle in degrees
      • fetchPosition

        protected Vector3d fetchPosition​(ParticleGroup.ParticleBean pb,
                                         Vector3d campos,
                                         Vector3d dest,
                                         double deltaYears)
        Fetches the real position of the particle. It will apply the necessary integrations (i.e. proper motion).
        Parameters:
        pb - The particle bean
        campos - The position of the camera. If null, the camera position is not subtracted so that the coordinates are given in the global reference system instead of the camera reference system.
        dest - The destination fector
        deltaYears - The delta years
        Returns:
        The vector for chaining
      • getMeanDistance

        public double getMeanDistance()
      • getMinDistance

        public double getMinDistance()
      • getMaxDistance

        public double getMaxDistance()
      • getDeltaYears

        protected double getDeltaYears()
        Returns the delta years to integrate the proper motion.
        Returns:
      • isCoordinatesTimeOverflow

        public boolean isCoordinatesTimeOverflow()
        Description copied from interface: IFocus
        Checks whether this foucs is within its valid time range, so that it can be used as a focus
        Specified by:
        isCoordinatesTimeOverflow in interface IFocus
        Returns:
        Whether the focus object is within its valid time range
      • mustAddToIndex

        public boolean mustAddToIndex()
        Description copied from class: SceneGraphNode
        Whether to add this node to the index
        Overrides:
        mustAddToIndex in class SceneGraphNode
        Returns:
        True if the node needs to be added to the index.
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable
        Overrides:
        dispose in class SceneGraphNode
      • highlight

        public void highlight​(boolean hl)
        Overrides:
        highlight in class FadeNode
      • highlight

        public void highlight​(boolean hl,
                              int index)
        Overrides:
        highlight in class FadeNode
      • setColorMin

        public void setColorMin​(double[] colorMin)
      • setColorMin

        public void setColorMin​(float[] colorMin)
      • setColorMax

        public void setColorMax​(double[] colorMax)
      • setColorMax

        public void setColorMax​(float[] colorMax)
      • getColorMin

        public float[] getColorMin()
      • getColorMax

        public float[] getColorMax()