| 766 | } |
| 767 | |
| 768 | boost::optional<face::ptr> ifcopenshell::geometry::taxonomy::curve_to_face_upgrade_impl(ptr item) { |
| 769 | boost::optional<face::ptr> face_; |
| 770 | auto circle_ = dcast<circle>(item); |
| 771 | auto ellipse_ = dcast<ellipse>(item); |
| 772 | auto line_ = dcast<line>(item); |
| 773 | auto bspline_curve_ = dcast<bspline_curve>(item); |
| 774 | |
| 775 | if (circle_ || ellipse_ || line_ || bspline_curve_) { |
| 776 | auto edge_ = make<edge>(); |
| 777 | if (circle_) { |
| 778 | edge_->basis = circle_; |
| 779 | } else if (ellipse_) { |
| 780 | edge_->basis = ellipse_; |
| 781 | } else if (line_) { |
| 782 | edge_->basis = line_; |
| 783 | } else if (bspline_curve_) { |
| 784 | edge_->basis = bspline_curve_; |
| 785 | } |
| 786 | |
| 787 | if (circle_ || ellipse_) { |
| 788 | // @todo |
| 789 | edge_->start = 0.; |
| 790 | edge_->end = 2 * boost::math::constants::pi<double>(); |
| 791 | } |
| 792 | |
| 793 | auto loop_ = make<loop>(); |
| 794 | loop_->children.push_back(edge_); |
| 795 | |
| 796 | face_ = make<face>(); |
| 797 | (*face_)->instance = loop_->instance; |
| 798 | (*face_)->matrix = loop_->matrix; |
| 799 | (*face_)->children = { clone(loop_) }; |
| 800 | } |
| 801 | return face_; |
| 802 | } |
| 803 | |
| 804 | namespace { |
| 805 | // @todo eliminate redundancy with cgal kernel |