3次元ベクトルクラスVector3ライブラリです。

Dependents:   Quaternion HAPS_GPS_Test_0002 GYSFDMAXB HAPS_EKF ... more

Files at this revision

API Documentation at this revision

Comitter:
Gaku0606
Date:
Sun Feb 25 19:44:38 2018 +0000
Parent:
3:3d5d3689521c
Commit message:
aaa;

Changed in this revision

Vector3.hpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3d5d3689521c -r d68f06f4d554 Vector3.hpp
--- a/Vector3.hpp	Sat Dec 16 02:38:25 2017 +0000
+++ b/Vector3.hpp	Sun Feb 25 19:44:38 2018 +0000
@@ -118,7 +118,7 @@
 	*  @bref  単位ベクトルにします
 	*/
 	void Normalize(){
-		float norm = sqrt(x*x + y*y + z*z);
+		float norm = sqrtf(x*x + y*y + z*z);
 		if (norm != 0.0f){
 			x /= norm;
 			y /= norm;
@@ -130,6 +130,12 @@
 		}
 	}
 
+	char* toString() {
+		char str[128] = {};
+		
+		sprintf(str, "(%f,%f,%f)", x, y, z);
+		return str;
+	}
 	
 };
 
@@ -216,7 +222,7 @@
 
 inline float Vector3::Angle(Vector3 vec){
 	float r = (*this % vec) / (this->Norm() * vec.Norm());
-	return acos(r);
+	return acosf(r);
 }
 
 inline float Vector3::SgnAngle(Vector3 vec){
@@ -228,7 +234,7 @@
 }
 
 inline float Vector3::Norm(){
-	return sqrt(x*x + y*y + z*z);
+	return sqrtf(x*x + y*y + z*z);
 }
 
 #endif
\ No newline at end of file