GPAxisCoordinates

De GENOPUS
Aller à la navigation Aller à la recherche
La version imprimable n’est plus prise en charge et peut comporter des erreurs de génération. Veuillez mettre à jour les signets de votre navigateur et utiliser à la place la fonction d’impression par défaut de celui-ci.

How to call it

For using the GPAxisCoordinates class, the developer has only to create such an object with these two possibilities:

  • Considering the vector will be automatically unitary (in that case, the third argument, corresponding to units must be null – anyway, it will never been considered):
axisUnitary = new GPAxisCoordinates("Unitary", false, null);
  • Considering the vector is not unitary ; in that case, we have also considered unities for the norm of the vector;
GUnit[] unitDis = { new GMetricUnit ("m/s") , new GMetricUnit ("km/s") };
axisNoUnitary = new GPAxisCoordinates("Not unitary", false, unitDis);

We also may initialize the widget with predefined values:

Vector3D iniVec = new Vector3D(1., 2., 3.);
axisUnitary = new GPAxisCoordinates("Unitary", true, iniVec, null);

Note: even if the initial values do not correspond to a unitary vector, they will be transform to fit with it.

Display

For both cases, the display will be:

GPAxisCoordinates.png

Note: by default, the not unitary case is in error mode when all components are set to zero but it is possible to change this behaviour using the setNormInterval() method.

How to use it

To get a [PATRIUS (CommonsMath)] Vector3D object, we will just have to call for the getPatriusObject() method as below:

Vector3D axis = axisNoUnitary.getPatriusObject();

How it is stored

Here is the XML format:

  <AxisCoordinates name="Unitary">
    <String name="type">Custom - Angular coordinates</String>
    <Real name="alpha" unit="deg">4.5E1</Real>
    <Real name="beta" unit="deg">1.0E1</Real>
  </AxisCoordinates>

  <AxisCoordinates name="Not_unitary">
    <String name="type">Custom - Axis coordinates</String>
    <Real name="x" unit="m/s">1.0E0</Real>
    <Real name="y" unit="m/s">2.0E0</Real>
    <Real name="z" unit="m/s">3.0E0</Real>
  </AxisCoordinates>