1 /* 2 * Copyright (C) 2023 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 OHOS_RENDER_3D_SPHERE_H 17 #define OHOS_RENDER_3D_SPHERE_H 18 19 #include "geometry.h" 20 21 namespace OHOS::Render3D { 22 class Sphere : public Geometry { 23 public: Sphere(std::string name,float radius,float rings,float sectors,Vec3 & position)24 Sphere(std::string name, float radius, float rings, float sectors, Vec3& position) 25 : Geometry(name, position), radius_(radius), rings_(rings), sectors_(sectors) {}; ~Sphere()26 virtual ~Sphere() {}; 27 GetType()28 int32_t GetType() const override 29 { 30 return GeometryType::SPHARE; 31 } 32 GetRadius()33 float GetRadius() const 34 { 35 return radius_; 36 } 37 GetRings()38 float GetRings() const 39 { 40 return rings_; 41 } 42 GetSectors()43 float GetSectors() const 44 { 45 return sectors_; 46 } 47 protected: IsEqual(const Geometry & obj)48 bool IsEqual(const Geometry& obj) const override 49 { 50 const auto& m = reinterpret_cast<const Sphere&>(obj); 51 52 return GetRadius() == m.GetRadius() 53 && GetRings() == m.GetRings() 54 && GetSectors() == m.GetSectors(); 55 } 56 57 private: 58 float radius_; 59 float rings_; 60 float sectors_; 61 }; 62 } // namespace OHOS::Render3D 63 #endif // OHOS_RENDER_3D_SPHERE_H 64