MCPcopy Create free account
hub / github.com/Nelarius/imnodes / RectangleOverlapsBezier

Function RectangleOverlapsBezier

imnodes.cpp:192–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192inline bool RectangleOverlapsBezier(const ImRect& rectangle, const CubicBezier& cubic_bezier)
193{
194 ImVec2 current =
195 EvalCubicBezier(0.f, cubic_bezier.P0, cubic_bezier.P1, cubic_bezier.P2, cubic_bezier.P3);
196 const float dt = 1.0f / cubic_bezier.NumSegments;
197 for (int s = 0; s < cubic_bezier.NumSegments; ++s)
198 {
199 ImVec2 next = EvalCubicBezier(
200 static_cast<float>((s + 1) * dt),
201 cubic_bezier.P0,
202 cubic_bezier.P1,
203 cubic_bezier.P2,
204 cubic_bezier.P3);
205 if (RectangleOverlapsLineSegment(rectangle, current, next))
206 {
207 return true;
208 }
209 current = next;
210 }
211 return false;
212}
213
214inline bool RectangleOverlapsLink(
215 const ImRect& rectangle,

Callers 1

RectangleOverlapsLinkFunction · 0.85

Calls 2

EvalCubicBezierFunction · 0.85

Tested by

no test coverage detected