Package ilda
Class IldaPoint
java.lang.Object
be.cmbsoft.ilda.IldaPoint
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
-
Constructor Summary
ConstructorDescriptionIldaPoint
(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 TypeMethodDescriptionboolean
int
getBestFittingPaletteColourIndex
(IldaPalette palette) This method picks the best fitting palette colour that matches this point's RGB value.byte
getBlue()
int
byte
getGreen()
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 parametersbyte
getRed()
float
getX()
float
getY()
float
getZ()
int
hashCode()
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 positionvoid
setColour
(int red, int green, int blue) Change this point's colour using RGB valuesvoid
setColour
(int paletteIndex, IldaPalette palette) Change this point's colour using a palette and a palette indexvoid
setColour
(IldaPalette palette) Change this point's colour using a palette and its palette indexvoid
setPosition
(float x, float y, float z) The position should be normalised so that x, y and z are between -1 and 1void
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
-
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-255green
-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
-
-
Method Details
-
setColour
public void setColour(int red, int green, int blue) Change this point's colour using RGB values -
getBestFittingPaletteColourIndex
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
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 topalette
- 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 PGraphicsframeHeight
- the height of the target PGraphicsframeDepth
- 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 positiony
- new Y positionz
- new Z position
-
getX
public float getX() -
getY
public float getY() -
getZ
public float getZ() -
getColour
public int getColour() -
setColour
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
-
hashCode
public int hashCode()
-