Module imp3d

Class SensorNodeGrid

All Implemented Interfaces:
Transformation, Pickable, Renderable, Manageable, PersistenceCapable, Shareable, UserFields, XObject, Map, Serializable

public class SensorNodeGrid extends ColoredNull implements Pickable, Renderable
A 2D grid of n×m spherical SensorNode sensors. The grid is centred at the local origin. Cell centres are spaced evenly across [-xDim/2, xDim/2] × [-yDim/2, yDim/2]. Every cell uses the same radius. Per-cell colours are supported; the default is white (sense all wavelengths). After a light-model computation, per-cell irradiance is retrieved via FluxLightModel.getSensedIrradianceGrid(SensorNodeGrid).
Author:
MH at YNL 2026
See Also:
  • Field Details

    • xDim

      protected float xDim
      Total extent of the grid along the local X axis (m).
    • yDim

      protected float yDim
      Total extent of the grid along the local Y axis (m).
    • n

      protected int n
      Number of sensor cells along the local X axis.
    • m

      protected int m
      Number of sensor cells along the local Y axis.
    • radius

      protected float radius
      Radius of each spherical sensor disc (m).
    • exponent

      protected float exponent
      Cosine-lobe exponent for directional sensitivity (0 = Lambertian).
    • numberOfLayers

      protected int numberOfLayers
      Number of horizontal layers stacked along the local Z axis.
    • layerSpacing

      protected float layerSpacing
      Distance between consecutive layer planes along local Z (m).
    • twoSided

      protected boolean twoSided
      If true each cell responds to rays arriving from both sides.
    • absoluteMode

      protected boolean absoluteMode
      If true, the light model accumulates total intercepted power [W] instead of irradiance [W m⁻²] per cell.
    • firstGroupIndex

      public transient int firstGroupIndex
      First GPU group index for this grid (cell (i,j) = firstGroupIndex + i*m + j).
    • cellVolumeIds

      public transient int[] cellVolumeIds
      Per-cell volume IDs for the CPU raytracer (index = i*m + j).
    • $TYPE

      public static final Node.NType $TYPE
    • xDim$FIELD

      public static final Node.NType.Field xDim$FIELD
    • yDim$FIELD

      public static final Node.NType.Field yDim$FIELD
    • n$FIELD

      public static final Node.NType.Field n$FIELD
    • m$FIELD

      public static final Node.NType.Field m$FIELD
    • radius$FIELD

      public static final Node.NType.Field radius$FIELD
    • exponent$FIELD

      public static final Node.NType.Field exponent$FIELD
    • numberOfLayers$FIELD

      public static final Node.NType.Field numberOfLayers$FIELD
    • layerSpacing$FIELD

      public static final Node.NType.Field layerSpacing$FIELD
    • twoSided$FIELD

      public static final Node.NType.Field twoSided$FIELD
    • absoluteMode$FIELD

      public static final Node.NType.Field absoluteMode$FIELD
  • Constructor Details

    • SensorNodeGrid

      public SensorNodeGrid()
      Creates a white 3×3 grid with default dimensions (1 m × 1 m) and sensor radius 0.1 m in irradiance mode.
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius)
      Creates a white n×m grid spanning xDim × yDim metres in irradiance mode.
      Parameters:
      xDim - total extent of the grid along the local X axis (m)
      yDim - total extent of the grid along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius)
      Creates a white n×m grid with uniform cell spacing in irradiance mode. The total grid dimensions are derived as xDim = n * xSpacing and yDim = m * ySpacing.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius, boolean absoluteMode)
      Creates a white n×m grid spanning xDim × yDim metres with the specified measurement mode.
      Parameters:
      xDim - total extent along the local X axis (m)
      yDim - total extent along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
      absoluteMode - if true, accumulates total intercepted power [W] instead of irradiance [W m⁻²] per cell
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius, boolean absoluteMode)
      Creates a white n×m grid with uniform cell spacing and the specified measurement mode.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
      absoluteMode - if true, accumulates total intercepted power [W] instead of irradiance [W m⁻²] per cell
    • SensorNodeGrid

      public SensorNodeGrid(RGBColor color)
      Creates a 3×3 grid with default dimensions and the specified spectral sensitivity colour.
      Parameters:
      color - spectral sensitivity colour applied to all cells
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius, RGBColor color)
      Creates an n×m grid spanning xDim × yDim metres with the given colour.
      Parameters:
      xDim - total extent along the local X axis (m)
      yDim - total extent along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
      color - spectral sensitivity colour applied to all cells
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius, RGBColor color)
      Creates an n×m grid with uniform cell spacing and the given colour.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
      color - spectral sensitivity colour applied to all cells
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius, boolean absoluteMode, RGBColor color)
      Creates an n×m grid spanning xDim × yDim metres with the specified measurement mode and colour.
      Parameters:
      xDim - total extent along the local X axis (m)
      yDim - total extent along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
      absoluteMode - if true, accumulates total intercepted power [W] instead of irradiance [W m⁻²] per cell
      color - spectral sensitivity colour applied to all cells
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius, boolean absoluteMode, RGBColor color)
      Creates an n×m grid with uniform cell spacing, the specified measurement mode and colour.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
      absoluteMode - if true, accumulates total intercepted power [W] instead of irradiance [W m⁻²] per cell
      color - spectral sensitivity colour applied to all cells
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius, int numberOfLayers, float layerSpacing)
      Creates a white n×m layered grid spanning xDim × yDim metres in irradiance mode.
      Parameters:
      xDim - total extent along the local X axis (m)
      yDim - total extent along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
      numberOfLayers - number of layers stacked along local Z
      layerSpacing - distance between consecutive layer planes (m)
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius, int numberOfLayers, float layerSpacing)
      Creates a white n×m layered grid with uniform cell spacing in irradiance mode.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
      numberOfLayers - number of layers stacked along local Z
      layerSpacing - distance between consecutive layer planes (m)
    • SensorNodeGrid

      public SensorNodeGrid(float xDim, float yDim, int n, int m, float radius, int numberOfLayers, float layerSpacing, boolean absoluteMode)
      Creates a white n×m layered grid spanning xDim × yDim metres with the specified measurement mode.
      Parameters:
      xDim - total extent along the local X axis (m)
      yDim - total extent along the local Y axis (m)
      n - number of sensor cells along X
      m - number of sensor cells along Y
      radius - radius of each spherical sensor disc (m)
      numberOfLayers - number of layers stacked along local Z
      layerSpacing - distance between consecutive layer planes (m)
      absoluteMode - if true, accumulates total intercepted power [W]
    • SensorNodeGrid

      public SensorNodeGrid(int n, int m, float xSpacing, float ySpacing, float radius, int numberOfLayers, float layerSpacing, boolean absoluteMode)
      Creates a white n×m layered grid with uniform cell spacing and the specified measurement mode.
      Parameters:
      n - number of sensor cells along X
      m - number of sensor cells along Y
      xSpacing - centre-to-centre spacing along X (m)
      ySpacing - centre-to-centre spacing along Y (m)
      radius - radius of each spherical sensor disc (m)
      numberOfLayers - number of layers stacked along local Z
      layerSpacing - distance between consecutive layer planes (m)
      absoluteMode - if true, accumulates total intercepted power [W]
  • Method Details

    • getCellColor

      public Color3f getCellColor(int i, int j)
      Returns the colour of cell (i, j), or white if no per-cell colour has been assigned.
    • getCellTransparency

      public float getCellTransparency(int i, int j)
      Returns the transparency of cell (i, j) in [0, 1], where 0 = fully opaque and 1 = fully transparent. Returns 0 if no per-cell transparency has been assigned.
    • getCellColorForLayer

      public Color3f getCellColorForLayer(int k, int i, int j)
      Returns the colour for layer k, cell (i, j). Falls back to getCellColor(int, int) if no layered colour is set.
    • getCellTransparencyForLayer

      public float getCellTransparencyForLayer(int k, int i, int j)
      Returns the transparency for layer k, cell (i, j) in [0, 1]. Falls back to getCellTransparency(int, int) if no layered transparency is set.
    • setColorCell

      public void setColorCell(float[][][] rgb)
      Sets per-cell colours from an n×m×3 array (values in [0,1]). rgb[i][j] = { r, g, b } for cell (i, j).
    • setColorCell

      public void setColorCell(float[][][] rgb, float transparency)
      Sets per-cell colours from an n×m×3 array and applies a uniform transparency to all cells. rgb[i][j] = { r, g, b } for cell (i, j).
      Parameters:
      rgb - n×m×3 colour array (values in [0, 1])
      transparency - transparency applied to every cell (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][][] rgb, float[][] transparencies)
      Sets per-cell colours from an n×m×3 array and individual transparency values. rgb[i][j] = { r, g, b } and transparencies[i][j] for cell (i, j).
      Parameters:
      rgb - n×m×3 colour array (values in [0, 1])
      transparencies - n×m transparency array (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][] values, ColorGradient gradient)
      Sets per-cell colours by mapping a 2D scalar array through a ColorGradient. values[i][j] is the scalar for cell (i, j).
    • setColorCell

      public void setColorCell(float[][] values, ColorGradient gradient, float transparency)
      Sets per-cell colours by mapping a 2D scalar array through a ColorGradient and applies a uniform transparency to all cells. values[i][j] is the scalar for cell (i, j).
      Parameters:
      values - n×m scalar array
      gradient - colour gradient to map scalar values to RGB
      transparency - transparency applied to every cell (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][] values, ColorGradient gradient, float[][] transparencies)
      Sets per-cell colours by mapping a 2D scalar array through a ColorGradient and individual transparency values. values[i][j] is the scalar for cell (i, j).
      Parameters:
      values - n×m scalar array
      gradient - colour gradient to map scalar values to RGB
      transparencies - n×m transparency array (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][][][] rgb)
      Sets per-layer per-cell colours from a layers×n×m×3 array (values in [0,1]). rgb[k][i][j] = { r, g, b } for layer k, cell (i, j).
    • setColorCell

      public void setColorCell(float[][][][] rgb, float transparency)
      Sets per-layer per-cell colours from a layers×n×m×3 array and applies a uniform transparency to all layers and cells.
      Parameters:
      rgb - layers×n×m×3 colour array (values in [0, 1])
      transparency - transparency applied to every cell (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][][][] rgb, float[][][] transparencies)
      Sets per-layer per-cell colours from a layers×n×m×3 array and individual per-layer per-cell transparency values.
      Parameters:
      rgb - layers×n×m×3 colour array (values in [0, 1])
      transparencies - layers×n×m transparency array (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][][] values, ColorGradient gradient)
      Sets per-layer per-cell colours by mapping a layers×n×m scalar array through a ColorGradient. values[k][i][j] is the scalar for layer k, cell (i, j).
    • setColorCell

      public void setColorCell(float[][][] values, ColorGradient gradient, float transparency)
      Sets per-layer per-cell colours by mapping a layers×n×m scalar array through a ColorGradient and applies a uniform transparency to all layers and cells.
      Parameters:
      values - layers×n×m scalar array
      gradient - colour gradient to map scalar values to RGB
      transparency - transparency applied to every cell (0 = opaque, 1 = fully transparent)
    • setColorCell

      public void setColorCell(float[][][] values, ColorGradient gradient, float[][][] transparencies)
      Sets per-layer per-cell colours by mapping a layers×n×m scalar array through a ColorGradient and individual per-layer per-cell transparency values.
      Parameters:
      values - layers×n×m scalar array
      gradient - colour gradient to map scalar values to RGB
      transparencies - layers×n×m transparency array (0 = opaque, 1 = fully transparent)
    • labelCell

      public void labelCell(float[][] values)
      Places a text label at the centre of each cell showing the value formatted to four decimal places. Pass null to remove all labels.
    • labelCell

      public void labelCell(float[][][] values)
      Places a text label at the centre of each cell per layer showing the corresponding value formatted to four decimal places. values[k][i][j] is the scalar for layer k, cell (i, j). Pass null to remove all layered labels.
    • getCellCenterX

      public float getCellCenterX(int i)
      Returns the local-space X centre of column i.
    • getCellCenterY

      public float getCellCenterY(int j)
      Returns the local-space Y centre of row j.
    • layerZ

      public float layerZ(int k)
      Returns the Z offset (in local space) of layer k. Layer 0 is at Z = 0; subsequent layers are spaced layerSpacing apart.
      Parameters:
      k - layer index (0-based)
      Returns:
      local Z coordinate of the layer plane
    • pick

      public void pick(Object object, boolean asNode, Point3d origin, Vector3d direction, Matrix4d t, PickList list)
      Description copied from interface: Pickable
      Computes intersections of a given ray with this shape.
      Specified by:
      pick in interface Pickable
      Parameters:
      object - the object of which this shape is an attribute
      asNode - true iff object is a node
      origin - the origin of the ray, in local coordinates
      direction - the direction of the ray, in local coordinates
      t - the transformation from local coordinates to world coordinates
      list - the list to which intersections have to be added
    • draw

      public void draw(Object object, boolean asNode, RenderState rs)
      Specified by:
      draw in interface Renderable
    • drawLabels

      public void drawLabels(RenderState rs)
      Draws only the text labels for each cell, without drawing any 3-D geometry. Called by GL4's ObjectCollector after it has drawn the cells itself.
    • getNTypeImpl

      protected Node.NType getNTypeImpl()
      Description copied from class: Node
      This method returns the Node.NType which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      getNTypeImpl in class Null
      Returns:
      type describing the managed fields of the class of this node
    • newInstance

      protected Node newInstance()
      Description copied from class: Node
      This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      newInstance in class Null
      Returns:
      new instance of class of this node
    • isTwoSided

      public boolean isTwoSided()
    • setTwoSided

      public void setTwoSided(boolean value)
    • isAbsoluteMode

      public boolean isAbsoluteMode()
    • setAbsoluteMode

      public void setAbsoluteMode(boolean value)
    • getN

      public int getN()
    • setN

      public void setN(int value)
    • getM

      public int getM()
    • setM

      public void setM(int value)
    • getNumberOfLayers

      public int getNumberOfLayers()
    • setNumberOfLayers

      public void setNumberOfLayers(int value)
    • getXDim

      public float getXDim()
    • setXDim

      public void setXDim(float value)
    • getYDim

      public float getYDim()
    • setYDim

      public void setYDim(float value)
    • getRadius

      public float getRadius()
    • setRadius

      public void setRadius(float value)
    • getExponent

      public float getExponent()
    • setExponent

      public void setExponent(float value)
    • getLayerSpacing

      public float getLayerSpacing()
    • setLayerSpacing

      public void setLayerSpacing(float value)