Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
nr-3dutils.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_NR_3DUTILS_H
3#define SEEN_NR_3DUTILS_H
4
5/*
6 * 3D utils. Definition of gdouble vectors of dimension 3 and of some basic
7 * functions.
8 * This looks redundant, why not just use Geom::Point for this?
9 *
10 * Authors:
11 * Jean-Rene Reinhard <jr@komite.net>
12 *
13 * Copyright (C) 2007 authors
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17
18#include <2geom/forward.h>
19
20namespace NR {
21
22#define X_3D 0
23#define Y_3D 1
24#define Z_3D 2
25
29struct Fvector {
31 v[0] = v[1] = v[2] = 0.0;
32 }
33 Fvector(double x, double y, double z) {
34 v[0] = x;
35 v[1] = y;
36 v[2] = z;
37 }
38 double v[3];
39 double &operator[](unsigned i) { return v[i]; }
40 double operator[](unsigned i) const { return v[i]; }
41};
42
46const static Fvector EYE_VECTOR(0, 0, 1);
47
54double norm(const Fvector &v);
55
62
70double scalar_product(const Fvector &a, const Fvector &b);
71
79void normalized_sum(Fvector &r, const Fvector &a, const Fvector &b);
80
91void convert_coord(double &x, double &y, double &z, Geom::Affine const &trans);
92
93} /* namespace NR */
94
95#endif /* SEEN_INKSCAPE_NR_3DUTILS_H */
96/*
97 Local Variables:
98 mode:c++
99 c-file-style:"stroustrup"
100 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
101 indent-tabs-mode:nil
102 fill-column:99
103 End:
104*/
105// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
3x3 matrix representing an affine transformation.
Definition affine.h:70
Contains forward declarations of 2geom types.
void normalize_vector(Fvector &v)
Normalizes a vector.
gdouble scalar_product(const Fvector &a, const Fvector &b)
Computes the scalar product between two Fvectors.
gdouble norm(const Fvector &v)
returns the euclidean norm of the vector v
static const Fvector EYE_VECTOR(0, 0, 1)
The eye vector.
void normalized_sum(Fvector &r, const Fvector &a, const Fvector &b)
Computes the normalized sum of two Fvectors.
void convert_coord(gdouble &x, gdouble &y, gdouble &z, Geom::Affine const &trans)
a type of 3 gdouble components vectors
Definition nr-3dutils.h:29
double & operator[](unsigned i)
Definition nr-3dutils.h:39
double operator[](unsigned i) const
Definition nr-3dutils.h:40
double v[3]
Definition nr-3dutils.h:38
Fvector(double x, double y, double z)
Definition nr-3dutils.h:33