summaryrefslogtreecommitdiff
path: root/app/bin/tcornu.h
blob: c41d381daf0590cd2483741ac0e436feb203330f (plain)
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
/*
 * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/bin/tcornu.h,v 1.1 2005-12-07 15:47:36 rc-flyer Exp $
 */

/*  XTrkCad - Model Railroad CAD
 *
 *  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
typedef struct {
		coOrd pos[2];
		coOrd c[2];
		ANGLE_T a[2];
		DIST_T r[2];
		DIST_T minCurveRadius;
		DIST_T maxRateofChange;
		DIST_T length;
		ANGLE_T windingAngle;
		dynArr_t arcSegs;
		coOrd descriptionOff;
		char * cornuPath;
		} cornuData_t;

typedef struct {
		coOrd pos[2];			//All values for end if trk[end] = NULL
		DIST_T radius[2];		//0.0 if straight
		ANGLE_T angle[2];		//Set if straight
		coOrd center[2];		//Set if radius >0
		} cornuParm_t;


double CornuMaxCurve(coOrd[2],ANGLE_T[2],DIST_T[2]);
double BezierMathMinRadius(coOrd[4]);
coOrd BezierMathFindNearestPoint(coOrd *, coOrd[4] , int );
track_p NewCornuTrack(coOrd pos[2], coOrd center[2], ANGLE_T angle[2], DIST_T radius[2], trkSeg_t * tempsegs, int count);
DIST_T CornuDistance( coOrd *, coOrd[2], ANGLE_T[2], DIST_T[2], trkSeg_t * ,int , double * );
BOOL_T FixUpCornu(coOrd pos[2], track_p [2], EPINX_T ep[2], struct extraData* xx);
BOOL_T FixUpCornu0(coOrd pos[2], coOrd center[2], ANGLE_T angle[2], DIST_T radius[2], struct extraData* xx);
BOOL_T GetCornuSegmentsFromTrack(track_p, trkSeg_p);
BOOL_T SetCornuEndPt(track_p trk, EPINX_T inx, coOrd pos, coOrd center, ANGLE_T angle, DIST_T radius);
BOOL_T RebuildCornu (track_p trk);

STATUS_T CornuDescriptionMove(track_p trk,wAction_t action,coOrd pos );
DIST_T CornuDescriptionDistance(coOrd pos,track_p trk );


BOOL_T CallCornu(coOrd[2],track_p[2],EPINX_T[2],dynArr_t *,cornuParm_t *);
BOOL_T CallCornu0(coOrd[2], coOrd[2], ANGLE_T[2], DIST_T[2], dynArr_t *,BOOL_T);

BOOL_T GetBezierSegmentsFromCornu(track_p, dynArr_t *);

char * CreateSegPathList(track_p trk);