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_CONE_H 17 #define OHOS_RENDER_3D_CONE_H 18 19 #include "geometry.h" 20 21 namespace OHOS::Render3D { 22 class Cone : public Geometry { 23 public: Cone(std::string name,float radius,float length,float sectors,Vec3 & position)24 Cone(std::string name, float radius, float length, float sectors, Vec3& position) : Geometry(name, position), 25 radius_(radius), length_(length), sectors_(sectors) {}; ~Cone()26 virtual ~Cone() {}; 27 GetType()28 int32_t GetType() const override 29 { 30 return GeometryType::CONE; // Cone type id 31 } 32 GetRadius()33 float GetRadius() const 34 { 35 return radius_; 36 } 37 GetLength()38 float GetLength() const 39 { 40 return length_; 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 Cone&>(obj); 51 52 return GetRadius() == m.GetRadius() 53 && GetLength() == m.GetLength() 54 && GetSectors() == m.GetSectors(); 55 } 56 private: 57 float radius_ { 0.0f }; 58 float length_ { 0.0f }; 59 float sectors_ { 0.0f }; 60 }; 61 } // namespace OHOS::Render3D 62 #endif // OHOS_RENDER_3D_CONE_H 63