Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
559237c
Add optimization demo application
Willem3141 Aug 22, 2023
4d1712f
Set up data structure for the smoothed tree
Willem3141 Aug 22, 2023
51165fd
Implement edge subdivision for the smooth tree
Willem3141 Aug 23, 2023
b19fc5d
Add a stub for the optimization routine
Willem3141 Aug 23, 2023
f6e0409
Run optimization in a QTimer in the demo
Willem3141 Aug 24, 2023
eca3d91
Implement smoothing cost
Willem3141 Aug 24, 2023
3fca5e2
Fix bug in the smooth tree generation
Willem3141 Aug 24, 2023
60abbe0
Various fixes to the smoothing cost
Willem3141 Aug 24, 2023
0b818ae
Implement smoothing costs properly
Willem3141 Aug 24, 2023
656c635
Fix smoothing cost sign issue causing instability
Willem3141 Aug 25, 2023
f0cc83a
Use random node locations in the optimization demo
Willem3141 Aug 25, 2023
5e2a11d
Store each node's flow in the smooth tree
Willem3141 Aug 31, 2023
009424f
Draw an outline for the flow map
Willem3141 Sep 1, 2023
ad68d34
Make setup for gradient computations more general
Willem3141 Sep 5, 2023
fde296b
Add the smoothing factor to the cost computation
Willem3141 Sep 7, 2023
fd4b651
Show the current cost function value in the demo
Willem3141 Sep 7, 2023
99b34bc
Implement angle restriction cost
Willem3141 Sep 7, 2023
dbf331c
Implement balancing cost
Willem3141 Sep 8, 2023
31b6650
Implement straightening cost
Willem3141 Sep 8, 2023
feb5a53
Show a cost graph in the optimization demo
Willem3141 Sep 12, 2023
bf4296d
Fix sign issues in the smooth tree optimization
Willem3141 Sep 20, 2023
c2b216b
Distinguish different types of costs in the GUI
Willem3141 Sep 20, 2023
ce8bf02
Add colors to the cost graph in the demo
Willem3141 Sep 21, 2023
261e9ce
Stop optimizing when encountering a nan
Willem3141 Sep 21, 2023
1026480
Add a toggle for the "stop on nan" behavior
Willem3141 Sep 21, 2023
ab5d0c0
Disable φ randomization in the demo
Willem3141 Sep 22, 2023
1eb7eab
Fix some small code style issues
Willem3141 Sep 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cartocrow/flow_map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set(SOURCES
polar_point.cpp
polar_segment.cpp
reachable_region_algorithm.cpp
smooth_tree.cpp
smooth_tree_painting.cpp
spiral.cpp
spiral_segment.cpp
spiral_tree.cpp
Expand All @@ -28,6 +30,8 @@ set(HEADERS
polar_point.h
polar_segment.h
reachable_region_algorithm.h
smooth_tree.h
smooth_tree_painting.h
spiral.h
spiral_segment.h
spiral_tree.h
Expand Down
6 changes: 6 additions & 0 deletions cartocrow/flow_map/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ struct Node {
/// leaf nodes, a node with the leaf type may have children if it is located
/// inside the spiral region of another node.
std::vector<std::shared_ptr<Node>> m_children;

/// The amount of flow through this node.
Number<Inexact> m_flow;

/// The index of this node in its tree.
int m_id = -1;
};

} // namespace cartocrow::flow_map
Expand Down
8 changes: 8 additions & 0 deletions cartocrow/flow_map/polar_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ const Number<Inexact> PolarPoint::phi() const {
return m_phi;
}

void PolarPoint::setR(Number<Inexact> r) {
m_r = r;
}

void PolarPoint::setPhi(Number<Inexact> phi) {
m_phi = phi;
}

Point<Inexact> PolarPoint::toCartesian() const {
const Vector<Inexact> d = Vector<Inexact>(std::cos(phi()), std::sin(phi()));
return Point<Inexact>(CGAL::ORIGIN) + r() * d;
Expand Down
11 changes: 5 additions & 6 deletions cartocrow/flow_map/polar_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,17 @@ class PolarPoint {
public:
/// Constructs a polar point at the origin.
PolarPoint();

/// Constructs a polar point at the origin.
[[deprecated]] PolarPoint(const CGAL::Origin& o);

/// Constructs a polar point with given \f$r\f$ and \f$\phi\f$.
PolarPoint(const Number<Inexact>& R, const Number<Inexact>& phi);

/// Copy constructor.
PolarPoint(const PolarPoint& p);

/// Constructs a polar point that corresponds to \f$p + t\f$, where \f$p\f$
/// is a polar point and \f$t\f$ is a vector in Cartesian coordinates.
PolarPoint(const PolarPoint& p, const Vector<Inexact>& t);

/// Constructs a polar point from a point in Cartesian coordinates.
explicit PolarPoint(const Point<Inexact>& p);

PolarPoint(const Point<Inexact>& p, const Vector<Inexact>& t);

/// Returns the distance \f$r\f$ from the origin.
Expand All @@ -67,6 +61,11 @@ class PolarPoint {
/// Returns the angle \f$\phi\f$ relative to the origin.
const Number<Inexact> phi() const;

/// Sets the distance \f$r\f$ from the origin.
void setR(Number<Inexact> r);
/// Sets the distance \f$\phi\f$ relative to the origin.
void setPhi(Number<Inexact> phi);

/// Returns the point in Cartesian coordinates corresponding to this polar
/// point.
Point<Inexact> toCartesian() const;
Expand Down
Loading