summaryrefslogtreecommitdiff
path: root/support/dktools/wxd2lxs.h
blob: 56982c15a4cbce370f497a6acc199dec4ff11a97 (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
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
/*
Copyright (C) 2018-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: wxd2lxs.ctr
*/

#ifndef WXD2LXS_H_INCLUDED
/** Avoid multiple inclusions. */
#define WXD2LXS_H_INCLUDED 1


#line 9 "wxd2lxs.ctr"

/**	@file	wxd2lxs.h	X-spline handling in wxd2lat.
*/

#ifndef	DK4ERROR_H_INCLUDED
#include "dk4error.h"
#endif

#ifndef	WXDTYPES_H_INCLUDED
#include "wxdtypes.h"
#endif

#ifdef	__cplusplus
extern "C" {
#endif


/**	Set up X-spline segment structure from X-spline data object.
	@param	xs		X-spline segment structure to set up.
	@param	pobj	X-spline object to obtain data from.
	@param	ib		Segment number.
*/

void
wxd2lxs_set_xspline(
	dk4_xsp_2d_t	*xs,
	wxd_object_t	*pobj,
	uint16_t		 ib
);


/**	Check spline object, if necessary calculate the segment lengths.
	@param	job		Job structure.
	@param	drw		Drawing structure.
	@param	pobj	Object to process.
	@paam	backptr	Address of success variable to reset on error.
*/
void
wxd2lxs_calculate_spline_segments(
	wxd2lat_job_t	*job,
	wxd_object_t	*pobj,
	int				*backptr
);


/**	Calculate coordinates and optionally direction for a given t value.
	This function can only be used for open splines with at least one
	arrowhead attached.
	@param	rp		Address of result variable to set on success.
					If d=0 a 2 elements array is required to store x and y.
					If d!=0 a 3 elements array is required to store
					x, y and alpha (direction angle).
	@param	pobj	X-spline object.
	@param	t		Parameter t.
	@param	d		Flag: Calculate derivative values.
	@param	erp		Error report, may be NULL.
	@return	1 on success, 0 on error (calculation failed).
*/

int
wxd2lxs_calculate(
	double			*rp,
	wxd_object_t	*pobj,
	double			 t,
	int				 d,
	dk4_er_t		*erp
);


/**	Calculate partial X-spline length from 0 to a given t value.
	This function can only be used for open splines with at least one
	arrowhead attached.
	@param	rp		Address of result variable to set on success.
	@param	pobj	X-spline object.
	@param	t		Parameter t.
	@param	eps		Required precision.
	@param	erp		Error report, may be NULL.
	@return	1 on success, 0 on error (calculation failed).
*/

int
wxd2lxs_length_to_parameter(
	double			*rp,
	wxd_object_t	*pobj,
	double			 t,
	double			 eps,
	dk4_er_t		*erp
);


/**	Find t parameter for a given partial X-spline length l.
	@param	rp		Address of result variable for t value.
	@param	pobj	Open X-spline with arrowhead(s).
	@param	l		Length to search to for.
	@param	xslp	Precision for length calculation.
	@param	xspp	Iteration precision for t.
	@param	erp		Error report, may be NULL.
	@return	1 on success, 0 on error.
*/

int
wxd2lxs_parameter_for_length(
	double			*rp,
	wxd_object_t	*pobj,
	double			 l,
	double			 xslp,
	double			 xspp,
	dk4_er_t		*erp
);


#ifdef	__cplusplus
}
#endif

/* vim: set ai sw=4 ts=4 : */


#endif