VeaR/JEllipse

pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit
Class Math3d

java.lang.Object
  extended by pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit.Math3d

public class Math3d
extends java.lang.Object

See Also:
calcTorsionalAngle(pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit.Vector3, pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit.Vector3, pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit.Vector3, pl.krakow.cmuj.bioinformatics.jellipse.mathtoolkit.Vector3), Peptide.estimateCurvatures()

Constructor Summary
Math3d()
          Creates a new instance of Math3d and warns that object of this class itself has no use
 
Method Summary
static float calcTorsionalAngle(Vector3 vatom1, Vector3 vatom2, Vector3 vatom3, Vector3 vatom4)
          Calculates torsional angle set up by four atoms
static Vector3 centerOfThreePointCircle(Vector3 v1, Vector3 v2, Vector3 v3)
          calculates the location of a circle that intersects three points (in 3d) and is (of course) co-planar with them ============= Here comes Maple code, that produced solutions ============== restart: with(linalg): 2 equations on radii equivalence, the 3rd on coplanar location eqns :={ (r0-a0)^2 + (r1-a1)^2 + (r2-a2)^2 = (r0-b0)^2 + (r1-b1)^2 + (r2-b2)^2, (r0-a0)^2 + (r1-a1)^2 + (r2-a2)^2 = (r0-c0)^2 + (r1-c1)^2 + (r2-c2)^2, det(matrix( [ [r0-a0, r1-a1, r2-a2], [b0-a0, b1-a1, b2-a2], [c0-a0, c1-a1, c2-a2] ] ))=0 }: rcoords := solve( eqns, {r0,r1,r2} ): x := simplify(subs(rcoords,r0)); y := simplify(subs(rcoords,r1)); z := simplify(subs(rcoords,r2)); distance test randomize(123): los := rand(-100..100): a0 := los(): a1 := los(): a2 := los(): b0 := los(): b1 := los(): b2 := los(): c0 := los(): c1 := los(): c2 := los(): dista:=evalf(sqrt((a0-x)^2 + (a1-y)^2 + (a2-z)^2)); distb:=evalf(sqrt((b0-x)^2 + (b1-y)^2 + (b2-z)^2)); distc:=evalf(sqrt((c0-x)^2 + (c1-y)^2 + (c2-z)^2)); visual test PLOT3D(POINTS( [a0,a1,a2], [b0,b1,b2], [c0,c1,c2], [x, y, z], SYMBOL(DIAMOND) ) ); ---------------------------------------------------------------------------
static float distance(Vector3 v1, Vector3 v2)
          calculates the distance between two points (vectors, dim = 3)
static Vector3 mapToSphere(float[] NewPt, float AdjustWidth, float AdjustHeight)
           
static void Matrix4fMulRotationScale(float[] NewObj, float scale)
           
static float[] Matrix4fSetRotationFromMatrix3f(float[] m1)
           
static float[] Matrix4fSetRotationScaleFromMatrix3f(float[] m1)
           
static float[] multiplyMatrix9(float[] m, float[] m1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Math3d

public Math3d()
Creates a new instance of Math3d and warns that object of this class itself has no use

Method Detail

distance

public static float distance(Vector3 v1,
                             Vector3 v2)
calculates the distance between two points (vectors, dim = 3)

Parameters:
v1 - one point as Vector3
v2 - another point Vector3
Returns:
euclidean distance between two points in dim=3 space

centerOfThreePointCircle

public static Vector3 centerOfThreePointCircle(Vector3 v1,
                                               Vector3 v2,
                                               Vector3 v3)
calculates the location of a circle that intersects three points (in 3d) and is (of course) co-planar with them
     ============= Here comes Maple code, that produced solutions ==============

            restart:
            with(linalg):

 2 equations on radii equivalence, the 3rd on coplanar location

            eqns :={ (r0-a0)^2 + (r1-a1)^2 + (r2-a2)^2 = (r0-b0)^2 + (r1-b1)^2 + (r2-b2)^2,
                     (r0-a0)^2 + (r1-a1)^2 + (r2-a2)^2 = (r0-c0)^2 + (r1-c1)^2 + (r2-c2)^2,
                     det(matrix( [ [r0-a0, r1-a1, r2-a2],
                                   [b0-a0, b1-a1, b2-a2],
                                   [c0-a0, c1-a1, c2-a2] ] ))=0
                   }:

            rcoords := solve( eqns,  {r0,r1,r2} ):

            x := simplify(subs(rcoords,r0));
            y := simplify(subs(rcoords,r1));
            z := simplify(subs(rcoords,r2));

 distance test

            randomize(123):  los := rand(-100..100):
            a0 := los():  a1 := los():  a2 := los():
            b0 := los():  b1 := los():  b2 := los():
            c0 := los():  c1 := los():  c2 := los():

            dista:=evalf(sqrt((a0-x)^2 + (a1-y)^2 + (a2-z)^2));
            distb:=evalf(sqrt((b0-x)^2 + (b1-y)^2 + (b2-z)^2));
            distc:=evalf(sqrt((c0-x)^2 + (c1-y)^2 + (c2-z)^2));

 visual test

            PLOT3D(POINTS(  [a0,a1,a2],
                            [b0,b1,b2],
                            [c0,c1,c2],
                            [x, y, z], SYMBOL(DIAMOND)
                         )
                  );     

     ---------------------------------------------------------------------------
     

Parameters:
v1 - one point (vector) as float[3]
v2 - another point (vector) as float[3]
v3 - yet another point (vector) as float[3]
Returns:
coordinates of the center of the cirlce in dim=3 space

calcTorsionalAngle

public static float calcTorsionalAngle(Vector3 vatom1,
                                       Vector3 vatom2,
                                       Vector3 vatom3,
                                       Vector3 vatom4)
Calculates torsional angle set up by four atoms

Parameters:
vatom1 - coords of the atom in the bond belonging to the first plane
vatom2 - coords of another atom in the bond belonging to the first plane
vatom3 - coords of the atom in the bond belonging to the second plane
vatom4 - coords of another atom in the bond belonging to the second plane

mapToSphere

public static Vector3 mapToSphere(float[] NewPt,
                                  float AdjustWidth,
                                  float AdjustHeight)

multiplyMatrix9

public static float[] multiplyMatrix9(float[] m,
                                      float[] m1)

Matrix4fSetRotationFromMatrix3f

public static float[] Matrix4fSetRotationFromMatrix3f(float[] m1)

Matrix4fSetRotationScaleFromMatrix3f

public static float[] Matrix4fSetRotationScaleFromMatrix3f(float[] m1)

Matrix4fMulRotationScale

public static void Matrix4fMulRotationScale(float[] NewObj,
                                            float scale)

VeaR/JEllipse