|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef T_L2LAUTOCLOSER_H
|
|
Toshihiro Shimizu |
890ddd |
#define T_L2LAUTOCLOSER_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
262a92 |
#include <memory></memory>
|
|
Shinya Kitaoka |
262a92 |
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TVECTORIMAGE_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4251)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class TStroke;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Line-to-line autocloser
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TL2LAutocloser
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
class Imp;
|
|
Shinya Kitaoka |
262a92 |
std::unique_ptr<imp> m_imp;</imp>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TL2LAutocloser();
|
|
Toshihiro Shimizu |
890ddd |
~TL2LAutocloser();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct Segment {
|
|
Toshihiro Shimizu |
890ddd |
//! the segments returned by the Line-to-line autocloser
|
|
Toshihiro Shimizu |
890ddd |
TStroke *stroke0, *stroke1; // the two involved strokes
|
|
Toshihiro Shimizu |
890ddd |
double w0, w1; // the w-parameters
|
|
Toshihiro Shimizu |
890ddd |
TThickPoint p0, p1; // the related points
|
|
Toshihiro Shimizu |
890ddd |
double dist2; // the (squared) points distance
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! segments longer than sqrt(dist2) are not considered. the default is 50^2
|
|
Toshihiro Shimizu |
890ddd |
void setMaxDistance2(double dist2);
|
|
Toshihiro Shimizu |
890ddd |
double getMaxDistance2() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! search line-to-line autoclosing segments.
|
|
Toshihiro Shimizu |
890ddd |
//! Note: it computes and caches some information about stroke0 and stroke1
|
|
Toshihiro Shimizu |
890ddd |
//! you are not supposed to change strokes between two subsequent calls to search()
|
|
Toshihiro Shimizu |
890ddd |
void search(std::vector<segment> &segments, TStroke *stroke0, TStroke *stroke1);</segment>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! use this method if you have already computed the intersections
|
|
Toshihiro Shimizu |
890ddd |
void search(
|
|
Toshihiro Shimizu |
890ddd |
std::vector<segment> &segments,</segment>
|
|
Toshihiro Shimizu |
890ddd |
TStroke *stroke0, TStroke *stroke1,
|
|
Toshihiro Shimizu |
890ddd |
const std::vector<doublepair> &intersection);</doublepair>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! debug only. show the internal state related to the last performed search
|
|
Toshihiro Shimizu |
890ddd |
void draw();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
TL2LAutocloser(const TL2LAutocloser &);
|
|
Toshihiro Shimizu |
890ddd |
const TL2LAutocloser &operator=(const TL2LAutocloser &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // T_L2LAUTOCLOSER_H
|