/usr/include/TopoFace/fgeomobjs.h is in ivtools-dev 1.2.11a1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /*
* Copyright (c) 1996-1997 Vectaport Inc.
* Copyright (c) 1990, 1991 Stanford University
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Stanford not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Stanford makes no representations about
* the suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
* IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Interface to geometrical objects with floating point coordinates
*/
#ifndef fgeomobjs_h
#define fgeomobjs_h
#include <IV-2_6/InterViews/defs.h>
#include <Unidraw/enter-scope.h>
class UList;
#include <iosfwd>
class FPointObj {
public:
FPointObj(float = 0, float = 0);
FPointObj(FPointObj*);
float Distance(FPointObj&);
public:
float _x, _y;
};
class FLineObj {
public:
FLineObj(float = 0, float = 0, float = 0, float = 0);
FLineObj(FLineObj*);
~FLineObj();
boolean Contains(FPointObj&);
int Same(FPointObj& p1, FPointObj& p2);
boolean Intersects(FLineObj&);
boolean EquationIntersects(FLineObj&, float &x, float&y);
int Bresenham(int*& xpts, int*& ypts);
int Extent(float& xmin, float& xmax, float& ymin, float& ymax);
public:
FPointObj _p1, _p2;
int* _xpts;
int* _ypts;
int _npts;
};
class FBoxObj {
public:
FBoxObj(float = 0, float = 0, float = 0, float = 0);
FBoxObj(FBoxObj*);
boolean Contains(FPointObj&);
boolean Intersects(FBoxObj&);
boolean Intersects(FLineObj&);
FBoxObj operator-(FBoxObj&);
FBoxObj operator+(FBoxObj&);
boolean Within(FBoxObj&);
public:
float _left, _right;
float _bottom, _top;
};
class FMultiLineObj {
public:
FMultiLineObj(float* = nil, float* = nil, int = 0);
virtual ~FMultiLineObj();
void GetBox(FBoxObj& b);
boolean Contains(FPointObj&);
boolean Intersects(FLineObj&);
boolean Intersects(FBoxObj&);
boolean Within(FBoxObj&);
void SplineToMultiLine(float* cpx, float* cpy, int cpcount);
void ClosedSplineToPolygon(float* cpx, float* cpy, int cpcount);
void GrowBuf(); // for use of above two methods
void GrowActualBuf();
int Bresenham(int*& xpts, int*& ypts);
void Extent(float& xmin, float& xmax, float& ymin, float& ymax);
protected:
boolean CanApproxWithLine(
double x0, double y0, double x2, double y2, double x3, double y3
);
void AddLine(double x0, double y0, double x1, double y1);
void AddBezierArc(
double x0, double y0, double x1, double y1,
double x2, double y2, double x3, double y3
);
void CalcSection(
float cminus1x, float cminus1y, float cx, float cy,
float cplus1x, float cplus1y, float cplus2x, float cplus2y
);
public:
float* _x, *_y;
int _count;
int _size;
UList* _ulist;
float* x() {return _x;}
float* y() {return _y;}
int count() const {return _count;}
int size() const {return _size;}
virtual boolean operator == (FMultiLineObj&);
virtual boolean operator != (FMultiLineObj&);
static FMultiLineObj* make_pts(const float* x, const float*y, int npts);
static void CompactPoints(boolean flag) {_pts_by_n_enabled=flag;}
protected:
static UList** _pts_by_n;
static int _pts_by_n_size;
static boolean _pts_by_n_enabled;
int* _xpts;
int* _ypts;
int _npts;
boolean _minmax;
float _xmin;
float _xmax;
float _ymin;
float _ymax;
};
class FFillPolygonObj : public FMultiLineObj {
public:
FFillPolygonObj(float* = nil, float* = nil, int = 0);
virtual ~FFillPolygonObj();
boolean Contains(FPointObj&);
boolean Intersects(FLineObj&);
boolean Intersects(FBoxObj&);
int Bresenham(int*& xpts, int*& ypts);
int SortedBorders(int*& ylocs, int*& xbegs, int*& xends, boolean*& xings);
double PolygonArea();
protected:
void Normalize();
protected:
float* _normx, *_normy;
int _normCount;
// for SortedBorders
int _runcnt; // number of sorted segments of horizontal perimeter
int* _ylocs; // y of segment
int* _xbegs; // beginning x of segment
int* _xends; // ending x of segment
boolean* _xings; // true if previous segment on different row from next
};
#endif
|