Subject: CGAL users discussion list
List archive
- From: "Fernando Cacciola" <>
- To: <>
- Subject: Re: [cgal-discuss] Straight_Skeleton_2
- Date: Thu, 22 Nov 2007 13:38:31 -0300
- Organization: Geometry Factory
sinan mutlu wrote:
Hi,It's a subset of the example generating offset polygons since that is based on a straight skeleton.
Is there an example code that finds the "straight skeleton" of a simple
concave or convex polygon.
But I guess which subset is a bit unclear, so here is it:
#include<vector>
#include<iterator>
#include<iostream>
#include<iomanip>
#include<string>
#include<boost/shared_ptr.hpp>
#include<CGAL/basic.h>
#include<CGAL/Cartesian.h>
#include<CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include<CGAL/Straight_skeleton_builder_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Straight_skeleton_2<Kernel> Ss;
typedef CGAL::Straight_skeleton_builder_traits_2<Kernel> SsBuilderTraits;
typedef CGAL::Straight_skeleton_builder_2<SsBuilderTraits,Ss> SsBuilder;
int main()
{
// A start-shaped polygon, oriented counter-clockwise as required for outer contours.
Point_2 pts[] = { Point_2(-1,-1)
, Point_2(0,-12)
, Point_2(1,-1)
, Point_2(12,0)
, Point_2(1,1)
, Point_2(0,12)
, Point_2(-1,1)
, Point_2(-12,0)
} ;
std::vector<Point_2> star(pts,pts+8);
SsBuilder ssb ;
ssb.enter_contour(frame,frame+4);
boost::shared_ptr<Ss> ss = ssb.construct_skeleton();
FWIW, I'm working on a simplified API, based on simple free functions.
The updated manual will contain much more examples using the simplified API
Best
Fernando Cacciola
GeometryFactory
- Straight_Skeleton_2, sinan mutlu, 11/22/2007
- Re: [cgal-discuss] Straight_Skeleton_2, Fernando Cacciola, 11/22/2007
- <Possible follow-up(s)>
- Straight_Skeleton_2, sinan mutlu, 11/23/2007
- Re: [cgal-discuss] Straight_Skeleton_2, Fernando Cacciola, 11/26/2007
Archive powered by MHonArc 2.6.16.