Class SoArithmetic

java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.inventor.algorithms.SoArithmetic

public class SoArithmetic extends Inventor
Arithmetic functions for buffers. The Arithmetic module provides basic Add, Multiply, etc functions that operate on buffers.

Examples:

See Also:
  • Constructor Details

    • SoArithmetic

      public SoArithmetic()
      Constructor.
  • Method Details

    • add

      public int add(SoBufferObject inputBufferA, SbDataType typeA, SoBufferObject inputBufferB, SbDataType typeB, SoBufferObject outputBufferC, SbDataType typeC)
      Add two buffers into a third one.
      C = A + B
      Note: C can be a reference to A or B.
      Limitation: typeA and typeB must be the same as typeC.
    • computeMinMaxWithUndefinedValue

      public double[] computeMinMaxWithUndefinedValue(SoBufferObject inputBuffer, SbDataType dataType, double undefinedValue)
      Compute min max of all values contained in a buffer that are not equal to the specified undefined value.

      Parameters:
      inputBuffer - The source buffer object.

      dataType - The type of the data in the source buffer object.

      undefinedValue - ignored value

      min - max Result values
    • shift

      public int shift(SoCpuBufferObject inputBufferA, SbDataType typeA, SoCpuBufferObject outputBufferB, SbDataType typeB, float shiftFactor)
      B = A + shiftFactor
      Fast version for Cpu buffers.
    • computeMinMaxWithUndefinedValue

      public double[] computeMinMaxWithUndefinedValue(SoCpuBufferObject inputBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range, double undefinedValue)
      Compute min max of values contained in the specified range of the buffer that are not equal to the specified undefined value.
      Fast version for Cpu buffers.
    • computeMinMaxWithUndefinedValue

      public double[] computeMinMaxWithUndefinedValue(SoBufferObject inputBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range, double undefinedValue)
      Compute min max of values contained in the specified range of the buffer that are not equal to the specified undefined value.

      Assumes the buffer contains a 3D array of values. However 1D and 2D arrays can be handled as degenerate cases. For example, to use a 1D array of length N and compute over the range I to J:
      • Set arrayDim = N,1,1 (do not use 0 for any dimension)
      • Set range = I,0,0,J,1,1 (be sure min and max for each axis are not the same)

      Parameters:
      inputBuffer - The source buffer object.

      dataType - The type of the data in the source buffer object.

      arrayDim - Dimensions of the array (can be degenerate, e.g. N,1,1)

      range - Subset of the array to consider

      undefinedValue - ignored value

      min - max Result values
    • computeMinMax

      public double[] computeMinMax(SoCpuBufferObject inputBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
      Compute min max of values contained in the specified range of the buffer.
      Fast version for Cpu buffers.
    • scale

      public int scale(SoBufferObject inputBufferA, SbDataType typeA, SoBufferObject outputBufferB, SbDataType typeB, float scaleValue)
      B = A * scaleFactor
      Note: B can be a reference to A
      Limitation: typeA must be the same as typeC.
    • madd

      public int madd(SoCpuBufferObject inputBufferA, SbDataType typeA, SoCpuBufferObject inputBufferB, SbDataType typeB, SoCpuBufferObject outputBufferC, SbDataType typeC, float scaleValue)
      C = A * scale + B
      Fast version for Cpu buffers.
    • madd

      public int madd(SoBufferObject inputBufferA, SbDataType typeA, SoBufferObject inputBufferB, SbDataType typeB, SoBufferObject outputBufferC, SbDataType typeC, float scaleValue)
      C = A * scale + B
      Note: C can be a reference to A or B
      Limitation: typeA and typeB must be the same as typeC.
    • shift

      public int shift(SoBufferObject inputBufferA, SbDataType typeA, SoBufferObject outputBufferB, SbDataType typeB, float shiftFactor)
      B = A + shiftFactor
      Note: B can be a reference to A
      Limitation: typeA must be the same as typeC.
    • scale

      public int scale(SoCpuBufferObject inputBufferA, SbDataType typeA, SoCpuBufferObject outputBufferB, SbDataType typeB, float scaleValue)
      B = A * scaleFactor
      Fast version for Cpu buffers.
    • computeMinMax

      public double[] computeMinMax(SoBufferObject inputBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
      Compute min max of values contained in the specified range of the buffer.

      Assumes the buffer contains a 3D array of values. However 1D and 2D arrays can be handled as degenerate cases. For example, to use a 1D array of length N and compute over the range I to J:
      • Set arrayDim = N,1,1 (do not use 0 for any dimension)
      • Set range = I,0,0,J,1,1 (be sure min and max for each axis are not the same)

      Parameters:
      inputBuffer - The source buffer object.

      dataType - The type of the data in the source buffer object.

      arrayDim - Dimensions of the array (can be degenerate, e.g. N,1,1)

      range - Subset of the array to consider

      min - max Result values
    • add

      public int add(SoCpuBufferObject inputBufferA, SbDataType typeA, SoCpuBufferObject inputBufferB, SbDataType typeB, SoCpuBufferObject outputBufferC, SbDataType typeC)
      Add two buffers into a third one.
      Fast version for Cpu buffers.
    • mult

      public int mult(SoBufferObject inputBufferA, SbDataType typeA, SoBufferObject inputBufferB, SbDataType typeB, SoBufferObject outputBufferC, SbDataType typeC)
      Multiply two buffers into a third one.
      C = A * B Note: C can be a reference to A or B
      Limitation: typeA and typeB must be the same as typeC
    • mult

      public int mult(SoCpuBufferObject inputBufferA, SbDataType typeA, SoCpuBufferObject inputBufferB, SbDataType typeB, SoCpuBufferObject outputBufferC, SbDataType typeC)
      Multiply two buffers into a third one.
      Fast version for Cpu buffers.
    • computeMinMax

      public double[] computeMinMax(SoBufferObject inputBuffer, SbDataType dataType)
      Compute min max of all values contained in a buffer.

      Parameters:
      inputBuffer - The source buffer object.

      dataType - The type of the data in the source buffer object.

      min - max Result values