Krita Source Code Documentation
Loading...
Searching...
No Matches
nugrid.h
Go to the documentation of this file.
1
2// einspline: a library for creating and evaluating B-splines //
3// Copyright (C) 2007 Kenneth P. Esler, Jr. //
4// //
5// This program is free software; you can redistribute it and/or modify //
6// it under the terms of the GNU General Public License as published by //
7// the Free Software Foundation; either version 2 of the License, or //
8// (at your option) any later version. //
9// //
10// This program is distributed in the hope that it will be useful, //
11// but WITHOUT ANY WARRANTY; without even the implied warranty of //
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13// GNU General Public License for more details. //
14// //
15// You should have received a copy of the GNU General Public License //
16// along with this program; if not, write to the Free Software //
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, //
18// Boston, MA 02110-1301 USA //
20
21#ifndef NUGRID_H
22#define NUGRID_H
23
24#include "local_definitions.h"
25
26typedef enum { LINEAR, GENERAL, CENTER, LOG } grid_type;
27
28// Nonuniform grid base structure
29typedef struct
30{
31 // public data
33 double start, end;
36 int (*reverse_map)(void *grid, double x);
37} NUgrid;
38
39#ifdef __cplusplus
40extern "C"
41#endif
42
43
44typedef struct
45{
46 // public data
48 double start, end;
51 int (*reverse_map)(void *grid, double x);
52
53 // private data
54 double a, aInv, b, bInv, center, even_half;
55 int half_points, odd_one;
56 bool odd;
58
59
60typedef struct
61{
62 // public data
64 double start, end;
67 int (*reverse_map)(void *grid, double x);
68
69 // private data
70 double a, ainv, startinv;
71} log_grid;
72
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78NUgrid*
79create_center_grid (double start, double end, double ratio,
80 int num_points);
81
82NUgrid*
83create_log_grid (double start, double end, int num_points);
84
85NUgrid*
86create_general_grid (double *points, int num_points);
87
88void
89destroy_grid (NUgrid *grid);
90
91#ifdef __cplusplus
92}
93#endif
94#endif
#define restrict
NUgrid * create_log_grid(double start, double end, int num_points)
Definition nugrid.cpp:135
NUgrid * create_center_grid(double start, double end, double ratio, int num_points)
Definition nugrid.cpp:83
grid_type
Definition nugrid.h:26
@ CENTER
Definition nugrid.h:26
@ GENERAL
Definition nugrid.h:26
@ LOG
Definition nugrid.h:26
@ LINEAR
Definition nugrid.h:26
void destroy_grid(NUgrid *grid)
Definition nugrid.cpp:173
NUgrid * create_general_grid(double *points, int num_points)
Definition nugrid.cpp:155
int num_points
Definition nugrid.h:35
double end
Definition nugrid.h:33
grid_type code
Definition nugrid.h:32
double *restrict points
Definition nugrid.h:34
double end
Definition nugrid.h:48
grid_type code
Definition nugrid.h:47
double a
Definition nugrid.h:54
double *restrict points
Definition nugrid.h:49
int num_points
Definition nugrid.h:50
int half_points
Definition nugrid.h:55
bool odd
Definition nugrid.h:56
double a
Definition nugrid.h:70
grid_type code
Definition nugrid.h:63
int num_points
Definition nugrid.h:66
double *restrict points
Definition nugrid.h:65
double end
Definition nugrid.h:64