File: plan.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (138 lines) | stat: -rw-r--r-- 5,353 bytes parent folder | download
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) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
 *           (C) 2021 Vladimir Sadovnikov <sadko4u@gmail.com>
 *
 * This file is part of lsp-dsp-units
 * Created on: 9 авг. 2021 г.
 *
 * lsp-dsp-units is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * lsp-dsp-units 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with lsp-dsp-units. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef LSP_PLUG_IN_DSP_UNITS_3D_RT_PLAN_H_
#define LSP_PLUG_IN_DSP_UNITS_3D_RT_PLAN_H_

#include <lsp-plug.in/dsp-units/version.h>
#include <lsp-plug.in/dsp-units/3d/rt/types.h>
#include <lsp-plug.in/dsp-units/3d/Allocator3D.h>
#include <lsp-plug.in/dsp-units/3d/Object3D.h>

namespace lsp
{
    namespace dspu
    {
        namespace rt
        {
            /**
             * This is a space cutting plan for the raytracing algorithm
             */
            typedef struct LSP_DSP_UNITS_PUBLIC plan_t
            {
                private:
                    plan_t(const plan_t &);
                    plan_t & operator = (const plan_t &);

                public:
                    Allocator3D<rt::split_t>    items;

                public:
                    explicit plan_t();
                    ~plan_t();

                public:
                    /**
                     * Clear plan: clear underlying structures
                     */
                    inline void     clear() { items.clear(); };

                    /**
                     * Flush plan: clear underlying structures and release memory
                     */
                    inline void     flush() { items.flush(); };

                    /**
                     * Check that the cutting plan is empty
                     * @return true if the cutting plan is empty
                     */
                    inline bool     is_empty() const { return items.size() == 0; }

                    /**
                     * Swap contents with another plan
                     * @param dst target plan to perform swap
                     */
                    inline void     swap(plan_t *dst) { items.swap(&dst->items);  }

                    /**
                     * Split raytrace plan and keep the only edges that are below the cutting plane
                     * @param pl cutting plane
                     * @return status of operation
                     */
                    status_t        cut_out(const dsp::vector3d_t *pl);

                    /**
                     * Split raytrace plan and keep the only edges that are above the cutting plane
                     * @param pl cutting plane
                     * @return status of operation
                     */
                    status_t        cut_in(const dsp::vector3d_t *pl);

                    /**
                     * Split raytrace plan and keep the only edges that are below the cutting plane,
                     * store all edges above the cutting plane to the other plan passed as parameter
                     * @param out plan to store all edges above the cutting plane
                     * @param pl cutting plane
                     * @return status of operation
                     */
                    status_t        split(plan_t *out, const dsp::vector3d_t *pl);

                    /**
                     * Add triangle to the plan
                     * @param pv three triangle points
                     * @param sp the equation of split plane provided by triangle
                     * @return status of operation
                     */
                    status_t        add_triangle(const dsp::point3d_t *pv);

                    /**
                     * Add triangle to the plan
                     * @param t triangle to add
                     * @param sp the equation of split plane provided by triangle
                     * @return status of operation
                     */
                    status_t        add_triangle(const rtm::triangle_t *t);

                    /**
                     * Add triangle to the plan
                     * @param pv three triangle points
                     * @param sp the equation of split plane provided by triangle
                     * @return status of operation
                     */
                    rt::split_t    *add_edge(const dsp::point3d_t *pv);

                    /**
                     * Add triangle to the plan
                     * @param pv three triangle points
                     * @param sp the equation of split plane provided by triangle
                     * @return status of operation
                     */
                    rt::split_t    *add_edge(const dsp::point3d_t *p1, const dsp::point3d_t *p2);

            } plan_t;
        } // namespace rt
    } // namespace dspu
} // namespace lsp




#endif /* LSP_PLUG_IN_DSP_UNITS_3D_RT_PLAN_H_ */