1 /* 2 * Copyright (c) 2022 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 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_GEOMETRY_NG_PROPERTIES_VECTORF_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_GEOMETRY_NG_PROPERTIES_VECTORF_H 18 19 #include "base/utils/utils.h" 20 21 namespace OHOS::Ace::NG { 22 23 struct VectorF { VectorFVectorF24 VectorF(float xF, float yF) : x(xF), y(yF) {} 25 26 bool operator==(const VectorF& other) const 27 { 28 return NearEqual(x, other.x) && NearEqual(y, other.y); 29 } 30 31 float x = 0.0f; 32 float y = 0.0f; 33 }; 34 35 struct Vector3F { Vector3FVector3F36 Vector3F(float xF, float yF, float zF) : x(xF), y(yF), z(zF) {} 37 38 bool operator==(const Vector3F& other) const 39 { 40 return NearEqual(x, other.x) && NearEqual(y, other.y) && NearEqual(z, other.z); 41 } 42 43 float x = 0.0f; 44 float y = 0.0f; 45 float z = 0.0f; 46 }; 47 48 struct Vector4F { Vector4FVector4F49 Vector4F(float xF, float yF, float zF, float wF) : x(xF), y(yF), z(zF), w(wF) {} 50 51 bool operator==(const Vector4F& other) const 52 { 53 return NearEqual(x, other.x) && NearEqual(y, other.y) && NearEqual(z, other.z) && NearEqual(w, other.w); 54 } 55 56 float x = 0.0f; 57 float y = 0.0f; 58 float z = 0.0f; 59 float w = 0.0f; 60 }; 61 62 } // namespace OHOS::Ace::NG 63 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_GEOMETRY_NG_PROPERTIES_VECTORF_H