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

Dependents:   Quaternion HAPS_GPS_Test_0002 GYSFDMAXB HAPS_EKF ... more

Revision:
4:d68f06f4d554
Parent:
3:3d5d3689521c
--- 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