Package ilda

Class IldaPoint

java.lang.Object
be.cmbsoft.ilda.IldaPoint

public class IldaPoint extends Object
A point of an ilda frame. Position is stored in a PVector with bounds [-1..1]. Colour is stored in an integer which is a 32-bit number: the first eight bits are not used, the second eight bits are red (0-255), the next eight represent green and the last eight bits are blue. This is the "official" colour representation: points also store a palIndex but this is only used to set the colour of a palette, never to render it to a screen. A point also has a blanked flag which determines if the point is off or on.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected int
     
    protected byte
     
    protected processing.core.PVector
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    IldaPoint (float x, float y, float z, int paletteIndex, boolean blanked)
     
    IldaPoint (float x, float y, float z, int red, int green, int blue, boolean blanked)
     
     
    IldaPoint (processing.core.PVector position, int red, int green, int blue, boolean blanked)
    Constructor for an IldaPoint.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals (Object o)
     
    int
    This method picks the best fitting palette colour that matches this point's RGB value.
    byte
     
    int
     
    byte
     
    byte
     
    processing.core.PVector
     
    processing.core.PVector
    getPosition (float frameWidth, float frameHeight, float frameDepth)
    Returns the point's position rescaled according to the frameWidth and frameHeight parameters
    byte
     
    float
    getX()
     
    float
    getY()
     
    float
    getZ()
     
    int
     
    boolean
     
    void
    setBlanked (boolean blanked)
    Set the blanked flag of a point Blanked means the lasers will not turn on at this point but the scanners will move to this position
    void
    setColour (int red, int green, int blue)
    Change this point's colour using RGB values
    void
    setColour (int paletteIndex, IldaPalette palette)
    Change this point's colour using a palette and a palette index
    void
    setColour (IldaPalette palette)
    Change this point's colour using a palette and its palette index
    void
    setPosition (float x, float y, float z)
    The position should be normalised so that x, y and z are between -1 and 1
    void
    setPosition (processing.core.PVector position)
    The position should be normalised so that the fields x, y and z of the argument PVector are always in the interval -1..1

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • position

      protected processing.core.PVector position
    • colour

      protected int colour
    • blanked

      protected boolean blanked
    • palIndex

      protected byte palIndex
  • Constructor Details

    • IldaPoint

      public IldaPoint (processing.core.PVector position, int red, int green, int blue, boolean blanked)
      Constructor for an IldaPoint.
      Parameters:
      position - a Processing PVector with the position of the newly created point: rescale the coordinates, so they're in [-1,1]! (0 = center)
      red - Integer between 0-255
      green -
      blue -
      blanked - True if the point should not be on or displayed
    • IldaPoint

      public IldaPoint (float x, float y, float z, int red, int green, int blue, boolean blanked)
    • IldaPoint

      public IldaPoint (float x, float y, float z, int paletteIndex, boolean blanked)
      Parameters:
      paletteIndex - A number corresponding to a colour in a palette, should be 0-255.
    • IldaPoint

      public IldaPoint (IldaPoint point)
  • Method Details

    • setColour

      public void setColour (int red, int green, int blue)
      Change this point's colour using RGB values
    • getBestFittingPaletteColourIndex

      public int getBestFittingPaletteColourIndex (IldaPalette palette)
      This method picks the best fitting palette colour that matches this point's RGB value. The palette index of this point is not set by this method, this needs to be done separately if required.
      Parameters:
      palette - the palette
      Returns:
      the index in the palette this point's colour matches best
    • getRed

      public byte getRed()
    • getGreen

      public byte getGreen()
    • getBlue

      public byte getBlue()
    • setColour

      public void setColour (int paletteIndex, IldaPalette palette)
      Change this point's colour using a palette and a palette index
      Parameters:
      paletteIndex - The position of the colour in the palette this point should change to
      palette - The palette in which this colour is
    • getPosition

      public processing.core.PVector getPosition (float frameWidth, float frameHeight, float frameDepth)
      Returns the point's position rescaled according to the frameWidth and frameHeight parameters
      Parameters:
      frameWidth - the width of the target PGraphics
      frameHeight - the height of the target PGraphics
      frameDepth - the depth of the target PGraphics
      Returns:
      a PVector with the position according to the received dimensions.
    • getPosition

      public processing.core.PVector getPosition()
    • setPosition

      public void setPosition (processing.core.PVector position)
      The position should be normalised so that the fields x, y and z of the argument PVector are always in the interval -1..1
      Parameters:
      position - the new position
    • setPosition

      public void setPosition (float x, float y, float z)
      The position should be normalised so that x, y and z are between -1 and 1
      Parameters:
      x - new X position
      y - new Y position
      z - new Z position
    • getX

      public float getX()
    • getY

      public float getY()
    • getZ

      public float getZ()
    • getColour

      public int getColour()
    • setColour

      public void setColour (IldaPalette palette)
      Change this point's colour using a palette and its palette index
      Parameters:
      palette - The palette the point should use to change its colour
    • isBlanked

      public boolean isBlanked()
    • setBlanked

      public void setBlanked (boolean blanked)
      Set the blanked flag of a point Blanked means the lasers will not turn on at this point but the scanners will move to this position
      Parameters:
      blanked - should the point be blanked?
    • getPalIndex

      public byte getPalIndex()
    • equals

      public boolean equals (Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object