mirror of https://github.com/CGAL/cgal
143 lines
4.1 KiB
Plaintext
143 lines
4.1 KiB
Plaintext
@ \subsection{Affine transformation of a map}
|
|
|
|
TODOS:
|
|
\begin{itemize}
|
|
\item sorting vertices not possible with inplace lists
|
|
\item reset minimal outedges
|
|
\item inserting and removing frame cornerns.
|
|
\end{itemize}
|
|
|
|
<<PM transformer implementation>>=
|
|
template <typename PMDEC, typename GEOM>
|
|
void PM_transformer<PMDEC,GEOM>::
|
|
transform(const Aff_transformation& t) const
|
|
{
|
|
TRACEN("transforming");
|
|
<<determine and store infimaximal frame corners>>
|
|
<<invert map if transformation is odd>>
|
|
<<transform vertices and reduce representation>>
|
|
<<recreate infimaximal frame>>
|
|
<<reset minimal outedges>>
|
|
}
|
|
|
|
<<protected members>>=
|
|
Vertex_handle Corner[4];
|
|
bool is_corner(Vertex_handle v) const
|
|
{ for (int i=0; i<4; ++i) if ( v == Corner[i] ) return true; }
|
|
|
|
<<determine and store infimaximal frame corners>>=
|
|
CGAL_assertion( point(vertices_begin())==K.SW() );
|
|
CGAL_assertion( point(--vertices_end())==K.NE() );
|
|
Vertex_iterator v = vertices_begin(); Corner[0] = v;
|
|
while ( point(v) != K.NW() ) ++v; Corner[1] = v;
|
|
while ( point(v) != K.SE() ) ++v; Corner[2] = v;
|
|
while ( point(v) != K.NE() ) ++v; Corner[3] = v;
|
|
|
|
<<invert map if transformation is odd>>=
|
|
if ( t.is_odd() ) reflecting_inversion();
|
|
|
|
<<transform vertices and reduce representation>>=
|
|
Vertex_iterator v;
|
|
for(v = vertices_begin(); v != vertices_end(); ++v)
|
|
K.transform(point(v),t);
|
|
|
|
<<recreate infimaximal frame>>=
|
|
<<sort vertices by points>>
|
|
v = vertices_begin();
|
|
if ( point(v) != K.SW() )
|
|
<<insert SW in frame edge>>
|
|
while ( K.on_left_box_segment(point(v)) ) ++v;
|
|
if ( point(--v) != K.NW() )
|
|
<<insert NW in frame edge>>
|
|
v = --vertices_end();
|
|
if ( point(v) != K.NE() )
|
|
<<insert NE in frame edge>>
|
|
while ( K.on_right_box_segment(point(v)) ) --v;
|
|
if ( point(++v) != K.SW() )
|
|
<<insert SW in frame edge>>
|
|
|
|
|
|
<<reset minimal outedges>>=
|
|
for(v = vertices_begin(); v != vertices_end(); ++v)
|
|
reset_minimal_outedge(v);
|
|
|
|
<<PM transformer>>=
|
|
template <typename PMDEC, typename GEOM>
|
|
class PM_transformer : public PMDEC {
|
|
typedef PM_transformer<PMDEC,GEOM> Self;
|
|
typedef PMDEC Base;
|
|
const GEOM& K; // geometry reference
|
|
|
|
public:
|
|
typedef PMDEC PM_decorator;
|
|
typedef typename PMDEC::Plane_map Plane_map;
|
|
typedef GEOM Geometry;
|
|
typedef typename GEOM::Point_2 Point;
|
|
typedef typename GEOM::sAff_transformation_2 Aff_transformation;
|
|
|
|
<<handles, iterators, and circulators from PMDEC>>
|
|
protected:
|
|
<<protected members>>
|
|
|
|
PM_transformer(Plane_map& P, const Geometry& g = Geometry()) :
|
|
void transform(const Aff_transformation& t) const;
|
|
|
|
}; // PM_transformer<PMDEC,GEOM>
|
|
|
|
|
|
<<handles, iterators, and circulators from PMDEC>>=
|
|
#define CGAL_USING(t) typedef typename PMDEC::t t
|
|
CGAL_USING(Halfedge_handle);
|
|
CGAL_USING(Vertex_handle);
|
|
CGAL_USING(Face_handle);
|
|
CGAL_USING(Vertex_iterator);
|
|
CGAL_USING(Halfedge_iterator);
|
|
CGAL_USING(Face_iterator);
|
|
#undef CGAL_USING
|
|
|
|
<<PM_transformer.h>>=
|
|
<<CGAL Header>>
|
|
#ifndef CGAL_PM_TRANSFORMER_H
|
|
#define CGAL_PM_TRANSFORMER_H
|
|
|
|
#undef _DEBUG
|
|
#define _DEBUG 13
|
|
#include <CGAL/Nef_2/debug.h>
|
|
|
|
CGAL_BEGIN_NAMESPACE
|
|
|
|
<<PM transformer>>
|
|
<<PM transformer implementation>>
|
|
|
|
CGAL_END_NAMESPACE
|
|
#endif // CGAL_PM_TRANSFORMER_H
|
|
|
|
<<CGAL Header>>=
|
|
// ============================================================================
|
|
//
|
|
// Copyright (c) 1997-2000 The CGAL Consortium
|
|
//
|
|
// This software and related documentation is part of an INTERNAL release
|
|
// of the Computational Geometry Algorithms Library (CGAL). It is not
|
|
// intended for general use.
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
//
|
|
// release : $CGAL_Revision$
|
|
// release_date : $CGAL_Date$
|
|
//
|
|
// file : include/CGAL/Nef_2/PM_transformer.h
|
|
// package : Nef_2
|
|
// chapter : Nef Polyhedra
|
|
//
|
|
// source : nef_2d/PM_transformer.lw
|
|
// revision : $Id$
|
|
// revision_date : $Date$
|
|
//
|
|
// author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
|
// maintainer : Michael Seel <seel@mpi-sb.mpg.de>
|
|
// coordinator : Michael Seel <seel@mpi-sb.mpg.de>
|
|
//
|
|
// implementation: Transformation module for plane maps
|
|
// ============================================================================
|