DartConstraint.h 1.22 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 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
    double delta() const { return std::abs(S1 - S0); };

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

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