DartConstraint.h 1.29 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
17
18
19
20
    std::shared_ptr<BoundaryConstraint> boundary_constraint() const { return Constraint; };

    std::shared_ptr<Curve const> constraint_curve() const { return Constraint->curve(); };

    size_t self() const { return Self; };

21
22
    size_t dart() const { return std::min(ForwardDart, ReverseDart); };

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

    size_t reverse_dart() const { return ReverseDart; };

27
28
29
30
    void add_to_queue(std::vector<std::unique_ptr<InsertionQueuer>> &queue, std::vector<DartConstraint> &constraints)  {
        Constraint->add_to_queue(queue, constraints, Self);
    }

31
32
33
34
35
36
37
38
39
    void forward_dart(size_t d) { ForwardDart = d; };

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

    double S0;
    double S1;

    size_t Self;

40
41
    size_t ForwardDart{SIZE_MAX};
    size_t ReverseDart{SIZE_MAX};
42
43
44
45
46
47

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

#endif //OERSTED_DARTCONSTRAINT_H