<commit_before>/*     __ __              _ 
 *    / // /_____ ____   (_)
 *   / // // ___// __ \ / / 
 *  / // // /__ / /_/ // /  
 * /_//_/ \___/ \____//_/   
 * https://bitbucket.org/galaktor/llcoi 
 * copyright (c) 2014, llcoi Team
 * MIT license applies - see file "LICENSE" for details.
*/
#include "ogre_interface.h"
#include <OgreQuaternion.h>
#include <OgreMatrix3.h>

QuaternionHandle quaternion_create() {
	Ogre::Quaternion * quat = new Ogre::Quaternion();
	return reinterpret_cast<QuaternionHandle>(quat);
}

void quaternion_from_rotation_matrix(QuaternionHandle handle, coiMatrix3 *rot) {
	Ogre::Matrix3 * mat = new Ogre::Matrix3(rot->m[0][0], rot->m[0][1], 
		rot->m[0][2], rot->m[1][0], rot->m[1][1], rot->m[1][2], rot->m[2][0], rot->m[2][1],
		rot->m[2][2]);
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	quat->FromRotationMatrix(*mat);
	delete mat;
}

QuaternionHandle quaternion_from_values(coiReal fW, coiReal fX, coiReal fY, coiReal fZ){
	Ogre::Quaternion * quat = new Ogre::Quaternion(fW, fX, fY, fZ);  
        return reinterpret_cast<QuaternionHandle>(quat);
}

void quaternion_from_angle_axis(QuaternionHandle handle, coiRadian rfAngle, coiVector3 rkAxis) {
        Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
        Ogre::Vector3 vec(rkAxis.x, rkAxis.y, rkAxis.z);
        quat->FromAngleAxis(Ogre::Radian(rfAngle), vec);
}

void quaternion_to_rotation_matrix(QuaternionHandle handle, coiMatrix3 *rot) {
	Ogre::Matrix3 *mat = new Ogre::Matrix3();
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	quat->ToRotationMatrix(*mat);
	rot->m[0][0] = *mat[0][0];
	rot->m[0][1] = *mat[0][1];
	rot->m[0][2] = *mat[0][2];
	rot->m[1][0] = *mat[1][0];
	rot->m[1][1] = *mat[1][1];
	rot->m[1][2] = *mat[1][2];
	rot->m[2][0] = *mat[2][0];
	rot->m[2][1] = *mat[2][1];
	rot->m[2][2] = *mat[2][2]; 
	delete mat;
}

coiReal quaternion_get_w(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->w);
}

coiReal quaternion_get_x(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->x);
}

coiReal quaternion_get_y(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->y);
}

coiReal quaternion_get_z(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->z);
}
<commit_msg>Change quaternion_from_angle_axis()'s coiVector3 to a Vector3Handle.<commit_after>/*     __ __              _ 
 *    / // /_____ ____   (_)
 *   / // // ___// __ \ / / 
 *  / // // /__ / /_/ // /  
 * /_//_/ \___/ \____//_/   
 * https://bitbucket.org/galaktor/llcoi 
 * copyright (c) 2014, llcoi Team
 * MIT license applies - see file "LICENSE" for details.
*/
#include "ogre_interface.h"
#include <OgreQuaternion.h>
#include <OgreMatrix3.h>

QuaternionHandle quaternion_create() {
	Ogre::Quaternion * quat = new Ogre::Quaternion();
	return reinterpret_cast<QuaternionHandle>(quat);
}

void quaternion_from_rotation_matrix(QuaternionHandle handle, coiMatrix3 *rot) {
	Ogre::Matrix3 * mat = new Ogre::Matrix3(rot->m[0][0], rot->m[0][1], 
		rot->m[0][2], rot->m[1][0], rot->m[1][1], rot->m[1][2], rot->m[2][0], rot->m[2][1],
		rot->m[2][2]);
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	quat->FromRotationMatrix(*mat);
	delete mat;
}

QuaternionHandle quaternion_from_values(coiReal fW, coiReal fX, coiReal fY, coiReal fZ){
	Ogre::Quaternion * quat = new Ogre::Quaternion(fW, fX, fY, fZ);  
        return reinterpret_cast<QuaternionHandle>(quat);
}

void quaternion_from_angle_axis(QuaternionHandle handle, coiRadian rfAngle, Vector3Handle vecHandle) {
        Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
        Ogre::Vector3 *rkAxis = reinterpret_cast<Ogre::Vector3*>(vecHandle);
        quat->FromAngleAxis(Ogre::Radian(rfAngle), *rkAxis);
}

void quaternion_to_rotation_matrix(QuaternionHandle handle, coiMatrix3 *rot) {
	Ogre::Matrix3 *mat = new Ogre::Matrix3();
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	quat->ToRotationMatrix(*mat);
	rot->m[0][0] = *mat[0][0];
	rot->m[0][1] = *mat[0][1];
	rot->m[0][2] = *mat[0][2];
	rot->m[1][0] = *mat[1][0];
	rot->m[1][1] = *mat[1][1];
	rot->m[1][2] = *mat[1][2];
	rot->m[2][0] = *mat[2][0];
	rot->m[2][1] = *mat[2][1];
	rot->m[2][2] = *mat[2][2]; 
	delete mat;
}

coiReal quaternion_get_w(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->w);
}

coiReal quaternion_get_x(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->x);
}

coiReal quaternion_get_y(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->y);
}

coiReal quaternion_get_z(QuaternionHandle handle) {
	Ogre::Quaternion *quat = reinterpret_cast<Ogre::Quaternion*>(handle);
	return coiReal(quat->z);
}

{'fraction_non_alphanumeric': 0.19225503618228046, 'fraction_numerical': 0.026794445530999415, 'mean_word_length': 5.059241706161138, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 76, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4369125', 'n_tokens_mistral': 2152, 'n_tokens_neox': 2107, 'n_words': 306}