jv.vecmath

## Class PdBaryDir

- java.lang.Object
- - jv.vecmath.P_Vector
  - - jv.vecmath.PdBaryDir

- All Implemented Interfaces:
    java.io.Serializable

      public class PdBaryDir
      extends P_Vector

  Barycentric tangent vector of arbitrary dimension, sum of entries must be 0. Internal array length is equal to barycentric dimension.
  See Also:
    Serialized Form
  Author:
    Konrad Polthier
  Version:
    23.08.06, 1.70 revised (mn) Added new instance variable m_elementInd.
    08.07.06, 1.60 revised (kp) Method clone() implemented to replace copyNew() when used by subclasses.
    20.02.03, 1.50 revised (ep) Methods getBaryDir/getVector return their result also as function value.
    05.02.03, 1.40 revised (ep) New methods `getBaryDir`.
    08.11.00, 1.30 revised (kp) Replace string formatting routines of Fmt with PuString.
    28.08.00, 1.20 revised (ep) Method sub(PdBary,PdBary) added.
    13.07.99, 1.10 revised (ep) Method multScalar() added.
    09.06.99, 1.00 created (kp)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `double[]` | `m_data` Array with barycentric coordinates, sum of entries must be 1.
    `static PdBaryDir[]` | `TRIANGLE_EDGE` Positive oriented edges.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PdBaryDir()` Construct empty class with zero size.
    `PdBaryDir(double x, double y)` Construct class with dimension=2 and given initial values.
    `PdBaryDir(double x, double y, double z)` Construct class with dimension=3 and given initial values.
    `PdBaryDir(double x, double y, double z, double w)` Construct class with dimension=4 and given initial values.
    `PdBaryDir(int aSize)` Construct class with given dimension.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(PdBaryDir dir)` Add two vectors `this = this+dir`.
    `static PdBaryDir[][]` | `alloc(int sizeI, int sizeJ, int vectorSize)` Allocate a new array of vectors, where all vectors have the same dimension.
    `void` | `blend(double a, PdBaryDir v, double b, PdBaryDir w)` Interpolate between two vectors with given weights.
    `void` | `blendBase(PdBaryDir v, double b, PdBaryDir w)` Interpolate between two vectors with given weights.
    `java.lang.Object` | `clone()` Clone object and all instance variables.
    `void` | `copy(PdBaryDir vec)` Copies argument vector into 'this', and possibly adjusts size of 'this'.
    `void` | `copyArray(PdBaryDir vec)` Copies only data (no flags) of argument vector into 'this', and possibly adjusts size of 'this'.
    `static PdBaryDir` | `copyNew(PdBaryDir v)` Create a new vector as clone of argument vector.
    `static PdBaryDir` | `getBaryDir(PdBaryDir baryout, PdVector dir, PdVector v0, PdVector v1, PdVector v2)` Get barycentric direction in triangle given by points.
    `static PdBaryDir` | `getBaryDir(PdBaryDir baryout, PdVector dir, PdVector v0, PdVector v1, PdVector v2, PdVector temp)` Get barycentric direction in triangle given by points.
    `int` | `getElementInd()` Get the element index to which the barycentric coordinates refer.
    `int` | `getSize()` Get dimension of barycentric vector.
    `static PdVector` | `getVector(PdVector p, PdBaryDir bary, PdVector v0, PdVector v1, PdVector v2)` Get vector from barycentric direction in a triangle.
    `void` | `leftMultMatrix(PdMatrix m)` Multiply vector with matrix `this = m*this`.
    `void` | `leftMultMatrix(PdMatrix m, PdBaryDir v)` Multiply vector with matrix `this = m*v`.
    `void` | `multScalar(double scalar)` Multiply all components with scalar.
    `void` | `multScalar(PdBaryDir v, double scalar)` Multiply argument vector with scalar `this = scalar*v`.
    `static PdBaryDir[]` | `realloc(PdBaryDir[] data, int arraySize, int vectorSize)` Allocate an array of baryDir vectors, where all vectors have the same dimension.
    `void` | `setElementInd(int ind)` Get the element index to which the barycentric coordinates refer.
    `int` | `setSize(int aSize)` Set dimension of barycentric vector, i.e. length of its data array.
    `void` | `setZero()` Set all entries to a constant zero value.
    `void` | `sub(PdBary m1, PdBary m2)` Difference of argument vectors `this = m1-m2`.
    `java.lang.String` | `toShortString()` Create a single-line string representation of the vector components and attributes.
    `java.lang.String` | `toString()` Create a multi-line string representation with detailed information about all instance variables.
    `void` | `validate()` Check sum of barycentric coordinates, and adjust if sum is not zero.

    - ### Methods inherited from class jv.vecmath.P_Vector

      `clearTag, clone, clone, copy, getBits, getDetail, getName, getURL, hasTag, invert, setDetail, setName, setTag, setURL`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TRIANGLE_EDGE

          public static final PdBaryDir[] TRIANGLE_EDGE

      Positive oriented edges. Index is the local index of opposite vertex to edge.

    - #### m_data

          public double[] m_data

      Array with barycentric coordinates, sum of entries must be 1. Length is equal to barycentric dimension.

  - ### Constructor Detail

    - #### PdBaryDir

          public PdBaryDir()

      Construct empty class with zero size.
      Version:
        27.12.01, 1.10 revised (kp) Now allocate array with zero length.

    - #### PdBaryDir

          public PdBaryDir(int aSize)

      Construct class with given dimension.

    - #### PdBaryDir

          public PdBaryDir(double x,
                           double y)

      Construct class with dimension=2 and given initial values.

    - #### PdBaryDir

          public PdBaryDir(double x,
                           double y,
                           double z)

      Construct class with dimension=3 and given initial values.

    - #### PdBaryDir

          public PdBaryDir(double x,
                           double y,
                           double z,
                           double w)

      Construct class with dimension=4 and given initial values.

  - ### Method Detail

    - #### alloc

          public static PdBaryDir[][] alloc(int sizeI,
                                            int sizeJ,
                                            int vectorSize)

      Allocate a new array of vectors, where all vectors have the same dimension.
      Parameters:
        `sizeI` - number of rows in new array
        `sizeJ` - number of columns in row[i] in new array
        `vectorSize` - dimension of vectors in new array
      See Also:
        `realloc(PdBaryDir [], int, int)`
      Version:
        27.11.06, 1.00 revised (kp)

    - #### realloc

          public static PdBaryDir[] realloc(PdBaryDir[] data,
                                            int arraySize,
                                            int vectorSize)

      Allocate an array of baryDir vectors, where all vectors have the same dimension. If argument `data!=null` then as most as possible of the content of existing vectors is copied into (possibly reused) vectors of the reallocated array.

      If requested array size is 0 then method returns an array of length 0.

      Parameters:
        `data` - possibly empty array of vectors
        `arraySize` - number of vectors in new array
        `vectorSize` - dimension of vectors in new array
      See Also:
        `PdVector.realloc(PdVector [], int, int)`
      Version:
        29.09.99 created (kp) From same method of PdVector.

    - #### setZero

          public void setZero()

      Set all entries to a constant zero value.

    - #### getElementInd

          public int getElementInd()

      Get the element index to which the barycentric coordinates refer.
      Returns:
        Index of this element to which the barycentric coordinates refer.
      Version:
        24.12.06 created (mn)

    - #### setElementInd

          public void setElementInd(int ind)

      Get the element index to which the barycentric coordinates refer.
      Parameters:
        `ind` - Index of this element to which the barycentric coordinates refer.
      Version:
        24.12.06 created (mn)

    - #### toString

          public java.lang.String toString()

      Create a multi-line string representation with detailed information about all instance variables.
      Overrides:
        `toString` in class `P_Vector`
      See Also:
        `toShortString()`

    - #### toShortString

          public java.lang.String toShortString()

      Create a single-line string representation of the vector components and attributes.
      See Also:
        `toString()`

    - #### clone

          public java.lang.Object clone()

      Clone object and all instance variables. Similar like `copyNew(PdBaryDir)` but this clone() method is consistent with possible subclasses while copyNew() explicitly creates a new PdBaryDir.
      Overrides:
        `clone` in class `P_Vector`
      See Also:
        `copyNew(PdBaryDir)`
      Version:
        08.07.06, 2.00 revised (kp) Now explicitly use superclass.clone().
        05.07.00, 1.00 created (kp)

    - #### copyNew

          public static PdBaryDir copyNew(PdBaryDir v)

      Create a new vector as clone of argument vector.
      Parameters:
        `v` - source vector to clone

    - #### copy

          public void copy(PdBaryDir vec)

      Copies argument vector into 'this', and possibly adjusts size of 'this'.
      Parameters:
        `vec` - the vector to be copied

    - #### copyArray

          public void copyArray(PdBaryDir vec)

      Copies only data (no flags) of argument vector into 'this', and possibly adjusts size of 'this'.
      Parameters:
        `vec` - the vector to be copied

    - #### getSize

          public int getSize()

      Get dimension of barycentric vector.

    - #### setSize

          public int setSize(int aSize)

      Set dimension of barycentric vector, i.e. length of its data array.
      Parameters:
        `aSize` - new number of components of vector
      Returns:
        new number of components of vector

    - #### blend

          public void blend(double a,
                            PdBaryDir v,
                            double b,
                            PdBaryDir w)

      Interpolate between two vectors with given weights. Uses `this = v*a + w*b`. If result vector 'this' is empty then its size is set to length of vector v, otherwise interpolation is done up to length of result vector.
      Parameters:
        `a` - weight of first vector
        `v` - first vector
        `b` - weight of second vector
        `w` - second vector
      See Also:
        `blendBase(PdBaryDir, double, PdBaryDir)`
      Author:
        Konrad Polthier
      Version:
        23.10.05, 1.00 created (kp) Converted from PdVector method.

    - #### blendBase

          public void blendBase(PdBaryDir v,
                                double b,
                                PdBaryDir w)

      Interpolate between two vectors with given weights. Uses `this = v + w*b`. If result vector 'this' is empty then its size is set to length of vector v, otherwise interpolation is done up to length of result vector.
      Parameters:
        `v` - first vector
        `w` - second vector
        `b` - weight of second vector
      See Also:
        `blend(double, PdBaryDir, double, PdBaryDir)`
      Author:
        Konrad Polthier
      Version:
        23.10.05, 1.00 created (kp) Converted from PdVector method.

    - #### validate

          public void validate()

      Check sum of barycentric coordinates, and adjust if sum is not zero.

    - #### multScalar

          public void multScalar(PdBaryDir v,
                                 double scalar)

      Multiply argument vector with scalar `this = scalar*v`. Vectors v and this must be of same size.
      Version:
        12.03.06, 1.00 created (kp)

    - #### multScalar

          public void multScalar(double scalar)

      Multiply all components with scalar.

    - #### leftMultMatrix

          public void leftMultMatrix(PdMatrix m)

      Multiply vector with matrix `this = m*this`. Matrix must be square and of same size than vector. Method does not change size of 'this'!
      Parameters:
        `m` - a matrix
      Version:
        12.03.06, 1.00 created (kp)

    - #### leftMultMatrix

          public void leftMultMatrix(PdMatrix m,
                                     PdBaryDir v)

      Multiply vector with matrix `this = m*v`. Matrix need not be square. Argument vector must have same size as number of columns of matrix. Method modifies size of this vector to number of rows of matrix.
      Version:
        12.03.06, 1.00 created (kp) From similar method of PdVector.

    - #### getVector

          public static PdVector getVector(PdVector p,
                                           PdBaryDir bary,
                                           PdVector v0,
                                           PdVector v1,
                                           PdVector v2)

      Get vector from barycentric direction in a triangle.
      Parameters:
        `p` - output, may be null; a new vector is returned in this case
      Returns:
        World-representation of `bary`. Same as `p` if that is not `null`.

    - #### getBaryDir

          public static PdBaryDir getBaryDir(PdBaryDir baryout,
                                             PdVector dir,
                                             PdVector v0,
                                             PdVector v1,
                                             PdVector v2)

      Get barycentric direction in triangle given by points.
      Parameters:
        `baryout` - output, may be null; a new barycentric vector is returned in this case
      Returns:
        Barycentric representation of `dir`. Same as `baryout` if that is not `null`.
      Since:
        JavaView 2.49.007

    - #### getBaryDir

          public static PdBaryDir getBaryDir(PdBaryDir baryout,
                                             PdVector dir,
                                             PdVector v0,
                                             PdVector v1,
                                             PdVector v2,
                                             PdVector temp)

      Get barycentric direction in triangle given by points.
      Parameters:
        `baryout` - may be null; a new barycentric vector is returned in this case
        `temp` - used as buffer, may be null (is allocated automatically in this case)
      Returns:
        Barycentric representation of `dir`. Same as `baryout` if that is not `null`.
      Since:
        JavaView 2.49.007
      Version:
        11.11.04, 1.10 revised (kh) Method rewritten.

    - #### sub

          public void sub(PdBary m1,
                          PdBary m2)

      Difference of argument vectors `this = m1-m2`. Vectors must be of same size. The elementIdx will be ignored.

    - #### add

          public void add(PdBaryDir dir)

      Add two vectors `this = this+dir`. Vectors must be of same size. The elementIdx will be ignored.

"

The software JavaView? is copyright protected. All Rights Reserved.
"