<commit_before>/*  Sirikata Utilities -- Math Library
 *  Location.hpp
 *
 *  Copyright (c) 2009, <NAME>
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are
 *  met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of Sirikata nor the names of its contributors may
 *    be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _LOCATION_HPP_
#define _LOCATION_HPP_

#include "Quaternion.hpp"

namespace Sirikata {

class Location: protected Vector3<double> {
    Vector3<float> mVelocity;
    Quaternion mOrientation;
    Vector3<float> mAxisOfRotation;
    float mAngularSpeed;
public:
    Location(){}
    Location(const Vector3<double>&position, 
             const Quaternion&orientation, 
             const Vector3<float> &velocity, 
             const Vector3<float> angularVelocityAxis, 
             float angularVelocityRadians):mVelocity(velocity),mOrientation(orientation),mAxisOfRotation(angularVelocityAxis), mAngularSpeed(angularVelocityRadians) {
        x=position.x;
        y=position.y;
        z=position.z;
    }
    const Vector3<double>&getPosition()const {
        return *this;
    }
    void setPosition(const Vector3<double>& position) {
        x=position.x;
        y=position.y;
        z=position.z;
    }
    const Vector3<float>&getVelocity()const {
        return mVelocity;
    }
    void setVelocity(const Vector3<float> velocity) {
        mVelocity=velocity;
    } 
    const Quaternion&getOrientation() const{
        return mOrientation;
    }
    void setOrientation(const Quaternion&orientation) {
        mOrientation=orientation;
    }
    const Vector3<float>&getAxisOfRotation() const {
        return mAxisOfRotation;
    }
    void setAxisOfRotation(const Vector3<float>&axis) {
        mAxisOfRotation=axis;
    }
    float getAngularSpeed() const{
        return mAngularSpeed;
    }
    void setAngularSpeed(float radianspersecond) {
        mAngularSpeed=radianspersecond;
    }
    void addAngularRotation(const Vector3<float> &axis, float radianspersecond) {
        mAxisOfRotation=mAxisOfRotation*mAngularSpeed+axis*radianspersecond;
        mAngularSpeed=mAxisOfRotation.length();
        mAxisOfRotation/=mAngularSpeed;
    }
    template<class TimeDuration> Location predict(const TimeDuration&dt)const {
        return Locaton(getPosition()+getVelocity()*(double)dt,
                       getOrientation()*Quaternion(getAxisOfRotation(),
                                                   getAngularSpeed()*(double)dt),
                       getVelocity(),
                       getAxisOfRotation(),
                       getAngularSpeed());
    }
};
}
#endif<commit_msg>more explicit on float32 vs float64<commit_after>/*  Sirikata Utilities -- Math Library
 *  Location.hpp
 *
 *  Copyright (c) 2009, <NAME>
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are
 *  met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of Sirikata nor the names of its contributors may
 *    be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _LOCATION_HPP_
#define _LOCATION_HPP_

#include "Quaternion.hpp"

namespace Sirikata {

class Location: protected Vector3<float64> {
    Vector3<float32> mVelocity;
    Quaternion mOrientation;
    Vector3<float32> mAxisOfRotation;
    float32 mAngularSpeed;
public:
    Location(){}
    Location(const Vector3<float64>&position, 
             const Quaternion&orientation, 
             const Vector3<float32> &velocity, 
             const Vector3<float32> angularVelocityAxis, 
             float32 angularVelocityRadians):mVelocity(velocity),mOrientation(orientation),mAxisOfRotation(angularVelocityAxis), mAngularSpeed(angularVelocityRadians) {
        x=position.x;
        y=position.y;
        z=position.z;
    }
    const Vector3<float64>&getPosition()const {
        return *this;
    }
    void setPosition(const Vector3<float64>& position) {
        x=position.x;
        y=position.y;
        z=position.z;
    }
    const Vector3<float32>&getVelocity()const {
        return mVelocity;
    }
    void setVelocity(const Vector3<float32> velocity) {
        mVelocity=velocity;
    } 
    const Quaternion&getOrientation() const{
        return mOrientation;
    }
    void setOrientation(const Quaternion&orientation) {
        mOrientation=orientation;
    }
    const Vector3<float32>&getAxisOfRotation() const {
        return mAxisOfRotation;
    }
    void setAxisOfRotation(const Vector3<float32>&axis) {
        mAxisOfRotation=axis;
    }
    float32 getAngularSpeed() const{
        return mAngularSpeed;
    }
    void setAngularSpeed(float32 radianspersecond) {
        mAngularSpeed=radianspersecond;
    }
    void addAngularRotation(const Vector3<float32> &axis, float32 radianspersecond) {
        mAxisOfRotation=mAxisOfRotation*mAngularSpeed+axis*radianspersecond;
        mAngularSpeed=mAxisOfRotation.length();
        mAxisOfRotation/=mAngularSpeed;
    }
    template<class TimeDuration> Location predict(const TimeDuration&dt)const {
        return Locaton(getPosition()+getVelocity()*(float64)dt,
                       getAngularSpeed() 
                        ? getOrientation()*Quaternion(getAxisOfRotation(),
                                                     getAngularSpeed()*(float64)dt)
                        : getOrientation(),
                       getVelocity(),
                       getAxisOfRotation(),
                       getAngularSpeed());
    }
};
}
#endif
{'fraction_non_alphanumeric': 0.07343091044405854, 'fraction_numerical': 0.00967501860580501, 'mean_word_length': 3.1116777154513002, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5753822', 'n_tokens_mistral': 2268, 'n_tokens_neox': 2089, 'n_words': 668}