Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5420 in orxonox.OLD for trunk/src/lib/math


Ignore:
Timestamp:
Oct 22, 2005, 1:57:29 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Font is now Right, and the Rendering 'should be' faster.

Location:
trunk/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/math/vector.cc

    r5005 r5420  
    1515
    1616   Quaternion code borrowed from an Gamasutra article by Nick Bobick and Ken Shoemake
     17
     18   2005-06-02: Benjamin Grauer: speed up, and new Functionality to Vector (mostly inline now)
    1719*/
    1820
     
    3032 *  returns the this-vector normalized to length 1.0
    3133 * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do.
    32 */
     34 */
    3335Vector Vector::getNormalized() const
    3436{
     
    5355/**
    5456 *  Outputs the values of the Vector
    55 */
     57 */
    5658void Vector::debug() const
    5759{
     
    7779 *
    7880 * @TODO !!! OPTIMIZE THIS !!!
    79 */
     81 */
    8082Quaternion::Quaternion (const Vector& dir, const Vector& up)
    8183{
     
    110112 * @param pitch: the pitch in radians
    111113 * @param yaw: the yaw in radians
    112 */
     114 */
    113115Quaternion::Quaternion (float roll, float pitch, float yaw)
    114116{
     
    136138 *  convert the Quaternion to a 4x4 rotational glMatrix
    137139 * @param m: a buffer to store the Matrix in
    138 */
     140 */
    139141void Quaternion::matrix (float m[4][4]) const
    140142{
     
    167169 * @param to where
    168170 * @param t the time this transformation should take value [0..1]
    169 
    170171 * @returns the Result of the smooth move
    171 */
     172 */
    172173Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t)
    173174{
     
    194195    }
    195196
    196   //if( (1.0 - cosom) > DELTA )
    197   //{
    198197  omega = acos(cosom);
    199198  sinom = sin(omega);
    200199  scale0 = sin((1.0 - t) * omega) / sinom;
    201200  scale1 = sin(t * omega) / sinom;
    202   //}
    203   /*
    204     else
    205     {
    206     scale0 = 1.0 - t;
    207     scale1 = t;
    208     }
    209   */
    210 
    211 
    212   /*
    213     Quaternion res;
    214     res.v.x = scale0 * from.v.x + scale1 * tol[0];
    215     res.v.y = scale0 * from.v.y + scale1 * tol[1];
    216     res.v.z = scale0 * from.v.z + scale1 * tol[2];
    217     res.w = scale0 * from.w + scale1 * tol[3];
    218   */
    219201  return Quaternion(Vector(scale0 * from.v.x + scale1 * tol[0],
    220                            scale0 * from.v.y + scale1 * tol[1],
    221                            scale0 * from.v.z + scale1 * tol[2]),
     202                    scale0 * from.v.y + scale1 * tol[1],
     203                    scale0 * from.v.z + scale1 * tol[2]),
    222204                    scale0 * from.w + scale1 * tol[3]);
    223205}
     
    227209 *  convert a rotational 4x4 glMatrix into a Quaternion
    228210 * @param m: a 4x4 matrix in glMatrix order
    229 */
     211 */
    230212Quaternion::Quaternion (float m[4][4])
    231213{
  • trunk/src/lib/math/vector.h

    r5419 r5420  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11### File Specific:
     12   main-programmer: Christian Meyer
     13   co-programmer: ...
     14*/
     15
    116/*!
    217 * @file vector.h
Note: See TracChangeset for help on using the changeset viewer.