« GPAxisCoordinates » : différence entre les versions

De GENOPUS
Aller à la navigation Aller à la recherche
(Page créée avec « == 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 b... »)
 
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
== How to call it ==
== How to call it ==


For using the GPAxisCoordinates class, the developer has only to create such an object with these two possibilities:
For using the <font color=#4169E1>GPAxisCoordinates</font> 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):
* 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):
Ligne 17 : Ligne 17 :


We also may initialize the widget with predefined values:
We also may initialize the widget with predefined values:


<syntaxhighlight lang="java">
<syntaxhighlight lang="java">

Version du 29 juillet 2017 à 12:24

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>