DartConstraint.h 1.32 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef OERSTED_DARTCONSTRAINT_H
#define OERSTED_DARTCONSTRAINT_H

#include <cstddef>
#include <memory>

#include "Sketch.hpp"

#include "BoundaryConstraint.h"

class DartConstraint {
public:
    DartConstraint(double s0, double s1, std::shared_ptr<BoundaryConstraint> bc, size_t self) : S0{s0}, S1{s1}, Constraint{bc}, Self{self}, ForwardDart{SIZE_MAX}, ReverseDart{SIZE_MAX} {};
14

15
16
    std::shared_ptr<BoundaryConstraint> boundary_constraint() const { return Constraint; };

17
    std::shared_ptr<Curve const> curve() const { return Constraint->curve(); };
18
19
20

    size_t self() const { return Self; };

21
    size_t dart() const { return (ForwardDart < SIZE_MAX ? ForwardDart : ReverseDart); };
22

23
24
25
26
    size_t forward_dart() const { return ForwardDart; };

    size_t reverse_dart() const { return ReverseDart; };

27
28
29
30
    size_t base(Mesh const &m) const;

    size_t tip(Mesh const &m) const;

31
32
33
    double delta() const { return std::abs(S1 - S0); };

    void add_to_queue(Mesh &m) const { Constraint->add_to_queue(m, dart()); };
34

35
36
37
38
39
40
41
42
43
    void forward_dart(size_t d) { ForwardDart = d; };

    void reverse_dart(size_t d) { ReverseDart = d; };

    double S0;
    double S1;

    size_t Self;

44
45
    size_t ForwardDart{SIZE_MAX};
    size_t ReverseDart{SIZE_MAX};
46
47
48
49
50
51

protected:
    std::shared_ptr<BoundaryConstraint> Constraint;
};

#endif //OERSTED_DARTCONSTRAINT_H