1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef MY_X_COMPONENT_VEC3_H 16 #define MY_X_COMPONENT_VEC3_H 17 18 19 class Vector3 { 20 public: Vector3(float x,float y,float z)21 Vector3(float x, float y, float z) : dataX(x), dataY(y), dataZ(z) {} 22 23 static Vector3 Add(Vector3 lhs, Vector3 rhs); 24 static Vector3 Add(Vector3 lhs, float rhs); 25 static Vector3 Subtract(Vector3 lhs, Vector3 rhs); 26 static Vector3 Subtract(Vector3 lhs, float rhs); 27 static Vector3 Multiply(Vector3 lhs, Vector3 rhs); 28 static Vector3 Multiply(Vector3 lhs, float rhs); 29 static Vector3 Divide(Vector3 lhs, Vector3 rhs); 30 static Vector3 Divide(Vector3 lhs, float rhs); 31 static Vector3 Distance(Vector3 lhs, Vector3 rhs); 32 static float Dot(Vector3 lhs, Vector3 rhs); 33 static Vector3 Cross(Vector3 lhs, Vector3 rhs); 34 static float Length(Vector3 lhs); 35 static Vector3 Normalize(Vector3 lhs); 36 37 float GetDataX(); 38 void SetDataX(float dataX); 39 float GetDataY(); 40 void SetDataY(float dataY); 41 float GetDataZ(); 42 void SetDataZ(float dataZ); 43 44 private: 45 float dataX; 46 float dataY; 47 float dataZ; 48 }; 49 #endif // MY_X_COMPONENT_VEC3_H