-
Notifications
You must be signed in to change notification settings - Fork 223
Defined a geometry for polyhedron #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Siddharth-coder13
wants to merge
12
commits into
boostorg:develop
from
Siddharth-coder13:3d-geometries
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
00df0e5
Defined a geometry for polyhedron
Siddharth-coder13 617970d
Changed name from Polyhedron to PolyhedralSurface
Siddharth-coder13 09917a0
Added prefix for PolyhedralSurface
Siddharth-coder13 2ee1f66
Fixed failed checks
Siddharth-coder13 f3355d8
Fixed failed checks
Siddharth-coder13 6db266c
Fixed failed checks
Siddharth-coder13 030d240
Added polyhedral concept check
Siddharth-coder13 b551f6d
Added wkt read feature to polyhedral surfaces
Siddharth-coder13 c1412c6
Added wkt write feature for polyhedral surfaces
Siddharth-coder13 90b4c79
Added suggested changes
Siddharth-coder13 d6b8e7c
Added suggested changes
Siddharth-coder13 408ca8f
Fixed identation
Siddharth-coder13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
|
||
// Polyhedral surface example | ||
|
||
#include <iostream> | ||
#include <boost/geometry/geometry.hpp> | ||
|
||
int main() | ||
{ | ||
using namespace boost::geometry; | ||
using point_t = model::point<double, 3, cs::cartesian>; | ||
using ring_t = model::ring<point_t>; | ||
using polyhedral_t = model::polyhedral_surface<ring_t>; | ||
|
||
// intializing an empty polyhedral surface (deafault constructor) | ||
polyhedral_t polyhedral2; | ||
|
||
// creating a polyhderal surface using standard initiallized list | ||
polyhedral_t polyhedral1 = {{{0,0,0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {0, 0, 1}, {0, 0, 0}}, | ||
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}, {0, 0, 0}}, {{1, 1, 1}, {1, 0, 1}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}}, {{1, 1, 1}, {1, 0, 1}, {1, 0, 0}, {1, 1, 0}, {1, 1, 1}}, | ||
{{1, 1, 1}, {1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}}}; | ||
|
||
// modifying a polyhedral surface | ||
polyhedral1[0][1] = {1, 1, 1}; | ||
|
||
// read polyhedral surface wkt | ||
read_wkt("POLYHEDRALSURFACE(((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)),((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)),((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)))", polyhedral2); | ||
|
||
// write polyhedral surface wkt | ||
std::cout << wkt(polyhedral1) << std::endl; | ||
|
||
std::cout << wkt(polyhedral2) << std::endl; | ||
|
||
// clear polyhedral surface | ||
clear(polyhedral1); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
include/boost/geometry/geometries/concepts/polyhedral_surface_concept.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYHEDRALSURFACE_HPP | ||
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYHEDRALSURFACE_HPP | ||
|
||
#include <boost/concept_check.hpp> | ||
#include <boost/range/concepts.hpp> | ||
#include <boost/geometry/core/access.hpp> | ||
#include <boost/geometry/core/ring_type.hpp> | ||
#include <boost/geometry/geometries/concepts/ring_concept.hpp> | ||
|
||
namespace boost { namespace geometry { namespace concepts | ||
{ | ||
|
||
template <typename Geometry> | ||
class PolyhedralSurface | ||
{ | ||
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS | ||
using ring_type = typename ring_type<Geometry>::type; | ||
|
||
BOOST_CONCEPT_ASSERT( (concepts::Ring<ring_type>) ); | ||
public: | ||
|
||
BOOST_CONCEPT_USAGE(PolyhedralSurface) | ||
{ | ||
} | ||
#endif | ||
}; | ||
|
||
// polyhedral surface(constant version) | ||
template <typename Geometry> | ||
class ConstPolyhedralSurface | ||
{ | ||
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS | ||
using const_polyhedral_type = typename std::remove_const<Geometry>::type; | ||
using ring_type = typename ring_type<const_polyhedral_type>::type; | ||
|
||
BOOST_CONCEPT_ASSERT( (concepts::ConstRing<ring_type>) ); | ||
|
||
public: | ||
|
||
BOOST_CONCEPT_USAGE(ConstPolyhedralSurface) | ||
{ | ||
} | ||
|
||
#endif | ||
}; | ||
|
||
}}} // namespace boost::geometry::concepts | ||
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYHEDRALSURFACE_HPP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
include/boost/geometry/geometries/polyhedral_surface.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#ifndef BOOST_GEOMETRY_GEOMETRIES_POLYHEDRALSURFACE_HPP | ||
#define BOOST_GEOMETRY_GEOMETRIES_POLYHEDRALSURFACE_HPP | ||
|
||
#include <memory> | ||
#include <vector> | ||
#include <boost/concept/assert.hpp> | ||
#include <boost/geometry/geometries/concepts/point_concept.hpp> | ||
#include <boost/geometry/geometries/ring.hpp> | ||
#include <boost/geometry/core/tag.hpp> | ||
#include <boost/geometry/core/tags.hpp> | ||
#include <boost/config.hpp> | ||
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST | ||
#include <initializer_list> | ||
#endif | ||
|
||
namespace boost { namespace geometry | ||
{ | ||
namespace model | ||
{ | ||
|
||
template | ||
< | ||
typename Ring, | ||
template<typename, typename> class Container = std::vector, | ||
template<typename> class Allocator = std::allocator | ||
|
||
> | ||
class polyhedral_surface : public Container<Ring, Allocator<Ring> > | ||
{ | ||
BOOST_CONCEPT_ASSERT( (concepts::Ring<Ring>) ); | ||
|
||
public : | ||
|
||
using point_type = model::point<double, 3, boost::geometry::cs::cartesian>; | ||
using ring_type = ring<point_type, true, true>; | ||
using ph = Container<ring_type, Allocator<ring_type> >; | ||
|
||
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST | ||
|
||
/// \constructor_default{polyhedron} | ||
inline polyhedral_surface() | ||
: ph() | ||
{} | ||
|
||
/// \constructor_initialized_list{polyhedron} | ||
inline polyhedral_surface(std::initializer_list<ring_type> l) | ||
: ph(l.begin(), l.end()) | ||
{} | ||
|
||
#endif | ||
|
||
}; | ||
} // namespace model | ||
|
||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS | ||
namespace traits | ||
{ | ||
|
||
template | ||
< | ||
typename Ring, | ||
template<typename, typename> class Container, | ||
template<typename> class Allocator | ||
> | ||
struct tag | ||
< | ||
model::polyhedral_surface | ||
< | ||
Ring, | ||
Container, Allocator | ||
> | ||
> | ||
{ | ||
using type = polyhedral_surface_tag; | ||
}; | ||
|
||
template | ||
< | ||
typename Ring, | ||
template<typename, typename> class Container, | ||
template<typename> class Allocator | ||
> | ||
struct poly_ring_type | ||
< | ||
model::polyhedral_surface | ||
< | ||
Ring, | ||
Container, Allocator | ||
> | ||
> | ||
{ | ||
using type = typename model::polyhedral_surface | ||
< | ||
Ring, | ||
Container, Allocator | ||
>::ring_type&; | ||
}; | ||
|
||
} // namespace traits | ||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS | ||
|
||
}} // namespace boost::geometry | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.