File: DrawfuncData.h

package info (click to toggle)
surf-alggeo 1.0.6%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 3,980 kB
  • ctags: 4,246
  • sloc: cpp: 22,587; yacc: 1,049; makefile: 519; lex: 327; ansic: 237; sh: 86
file content (137 lines) | stat: -rw-r--r-- 3,787 bytes parent folder | download | duplicates (5)
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
/*
 *   surf - visualizing algebraic curves and algebraic surfaces
 *   Copyright (C) 1996-1997 Friedrich-Alexander-Universitaet
 *                           Erlangen-Nuernberg
 *                 1997-2000 Johannes Gutenberg-Universitaet Mainz
 *   Authors: Stephan Endrass, Hans Huelf, Ruediger Oertel,
 *            Kai Schneider, Ralf Schmitt, Johannes Beigel
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */




#ifndef DRAWFUNCDATA_H
#define DRAWFUNCDATA_H

#include <assert.h>

//#include "polyarith.h"
#include "MultiVariatePolynom.h"
#include "WindowGeometry.h"


class Clip;
class Vector;
class Position;
class RationalHornerXY;
class HornergroupXY;
class HornergroupXYZ;
class float_buffer;
class RgbBuffer;

class DrawfuncData
{
private:
	DrawfuncData(const DrawfuncData &);
	void operator=(const DrawfuncData &);

public:
	DrawfuncData( RgbBuffer *intensity, float_buffer *zbuff,
		      RationalHornerXY*, HornergroupXYZ*, HornergroupXY*,
		      Clip*, Position*,
		      double );
	~DrawfuncData();

	void SetBorders (int xmin, int xmax, int ymin, int ymax)
		{
			min[0]=xmin;
			min[1]=ymin;
			max[0]=xmax;
			max[1]=ymax;
		}

	void setGeometry (const WindowGeometry &wg)
		{
			wingeo = wg;
			Delta[VARIABLE_X] = wg.getDelta( VARIABLE_X );
			Delta[VARIABLE_Y] = wg.getDelta( VARIABLE_Y );
		};



	// draw curves or cutlines working x/y direction
	void PrintCurve( int );

	// paint point if visible at user coordinates
	void PaintPoint( double, double );
	int  DoRow( int, int, double, int, double, double, double* );
	int  DoPixel( int, int, double, double, int, double, double, double* );

private:
	// set min and max pixel value
	void   GetBorders( int dir, int &vmin, int &vmax )
		{
			assert(dir==0||dir==1);

			vmin = min[dir];
			vmax = max[dir];
		}

	bool SetZbuffer (int x, int y, double val);
// 		{
// 			return mywindow->SetZbuffer(x,y,val);
// 		};
	
	void SetCurvePixel (int x, int y, double val);
// 		{
// 			mywindow->SetCurvePixel(x,y,val);
// 		};

	double ToUser (int dir, double pix)
		{ return wingeo.pixelToUser(dir,pix);};

	double ToPixel (int dir, double u)
		{return wingeo.userToPixel(dir,u);};

	double GetDelta (int dir)
		{return wingeo.getDelta(dir);};
private:
	RationalHornerXY* Plane;         // rational equation for plane solved to z
	HornergroupXYZ* Surface;         // surface with derivates
	HornergroupXY*    Curve;         // curve with orth derivative,
	                                 //  xy and yx
	Clip            *clip;                   // clipping
// 	Mywindow        *mywindow;               // window 
	Position        *position;               // position : turn shift and scale

	double          PointWidth;              // width of curve
	double          PointDiv;                // 4*pointwidth
	double          MaxDist;                 // calculated from pointwidth
	double          Delta[2];                // distance between rows/cols
	double          WinSizeFactor;	   // for relative PointWidth (Size of Window)
	
	WindowGeometry wingeo;

	RgbBuffer *intensity;
	float_buffer *zbuffer;
	int min[2],max[2];

};


#endif