1
#ifndef __SP_SPIRAL_H__
2
#define __SP_SPIRAL_H__
5
* SPSpiral: <sodipodi:spiral> implementation
8
* Mitsuru Oka <oka326@parkcity.ne.jp>
9
* Lauris Kaplinski <lauris@kaplinski.com>
11
* Copyright (C) 1999-2002 Lauris Kaplinski
12
* Copyright (C) 2000-2001 Ximian, Inc.
14
* Released under GNU GPL, read the file 'COPYING' for more information
19
#define noSPIRAL_VERBOSE
21
#define SP_EPSILON 1e-5
22
#define SP_EPSILON_2 (SP_EPSILON * SP_EPSILON)
25
#define SPIRAL_TOLERANCE 3.0
26
#define SAMPLE_STEP (1.0/4.0) ///< step per 2PI
27
#define SAMPLE_SIZE 8 ///< sample size per one bezier
29
#define SP_TYPE_SPIRAL (sp_spiral_get_type ())
30
#define SP_SPIRAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SPIRAL, SPSpiral))
31
#define SP_SPIRAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SPIRAL, SPSpiralClass))
32
#define SP_IS_SPIRAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SPIRAL))
33
#define SP_IS_SPIRAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SPIRAL))
41
* The Spiral shape is defined as:
43
x(t) = rad * t^exp cos(2 * Pi * revo*t + arg) + cx
44
y(t) = rad * t^exp sin(2 * Pi * revo*t + arg) + cy \endverbatim
45
* where spiral curve is drawn for {t | t0 <= t <= 1}. The rad and arg
46
* parameters can also be represented by transformation.
48
* \todo Should I remove these attributes?
50
struct SPSpiral : public SPShape {
52
float exp; ///< Spiral expansion factor
53
float revo; ///< Spiral revolution factor
54
float rad; ///< Spiral radius
55
float arg; ///< Spiral argument
59
/// The SPSpiral vtable.
60
struct SPSpiralClass {
61
SPShapeClass parent_class;
65
/* Standard Gtk function */
66
GType sp_spiral_get_type (void);
68
/* Lowlevel interface */
69
void sp_spiral_position_set (SPSpiral *spiral,
78
NR::Point sp_spiral_get_xy (SPSpiral const *spiral,
81
void sp_spiral_get_polar (SPSpiral const *spiral,
86
bool sp_spiral_is_invalid (SPSpiral const *spiral);