Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
MathUtil.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32/*Code references:
33 Matrix inverse: http://www.devmaster.net/forums/showthread.php?t=14569
34 Matrix multiply:
35 http://fhtr.blogspot.com/2010/02/4x4-float-matrix-multiplication-using.html
36 Square root: http://www.codeproject.com/KB/cpp/Sqrt_Prec_VS_Speed.aspx
37*/
38
39#pragma once
40#ifndef DVD_CORE_MATH_MATH_UTIL_H_
41#define DVD_CORE_MATH_MATH_UTIL_H_
42
43#include "MathVectors.h"
44
45namespace Divide {
46namespace Util {
47
49 explicit GraphPlot(string name) noexcept : _plotName(MOV(name))
50 {
51 }
52 virtual ~GraphPlot() = default;
53
54 string _plotName;
55 [[nodiscard]] virtual bool empty() const noexcept = 0;
56};
57
58struct GraphPlot2D final : GraphPlot {
59 GraphPlot2D() noexcept : GraphPlot2D("UNNAMED_PLOT_2D")
60 {
61 }
62
63 explicit GraphPlot2D(string&& name) noexcept : GraphPlot(MOV(name))
64 {
65 }
66
68
69 [[nodiscard]] bool empty() const noexcept override {
70 return _coords.empty();
71 }
72};
73
74struct GraphPlot3D final : GraphPlot {
75 GraphPlot3D() noexcept : GraphPlot3D("UNNAMED_PLOT_3D")
76 {
77 }
78
79 explicit GraphPlot3D(string&& name) noexcept : GraphPlot(MOV(name))
80 {
81 }
82
84
85 [[nodiscard]] bool empty() const noexcept override {
86 return _coords.empty();
87 }
88};
89
90} // namespace Util
91} // namespace Divide
92
93#endif //DVD_CORE_MATH_MATH_UTIL_H_
#define MOV(...)
#define NOINITVTABLE
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
eastl::vector< Type > vector
Definition: Vector.h:42
bool empty() const noexcept override
Definition: MathUtil.h:69
GraphPlot2D() noexcept
Definition: MathUtil.h:59
GraphPlot2D(string &&name) noexcept
Definition: MathUtil.h:63
vector< vec2< F32 > > _coords
Definition: MathUtil.h:67
bool empty() const noexcept override
Definition: MathUtil.h:85
vector< vec3< F32 > > _coords
Definition: MathUtil.h:83
GraphPlot3D(string &&name) noexcept
Definition: MathUtil.h:79
GraphPlot3D() noexcept
Definition: MathUtil.h:75
GraphPlot(string name) noexcept
Definition: MathUtil.h:49
virtual bool empty() const noexcept=0
virtual ~GraphPlot()=default