Generated reference › API — ICoreEssentials/UI/Geometry
kind: generated#api#icoreessentials-ui-geometry

API — ICoreEssentials/UI/Geometry

The public contract of 6 header(s) under src/ICoreEssentials/UI/Geometry — 4 class/struct definition(s), 54 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreGeometryOps.h#

src/ICoreEssentials/UI/Geometry/ICoreGeometryOps.h

Rectangle operations ICoreRect does not carry.

Free functions rather than methods because ICoreEssentials is frozen: its geometry types are the non-UI wrapper axis and are not ours to extend. The arithmetic below is written against the same edge convention ICoreRect documents (right == x + width, no -1 anywhere), so these compose with it exactly as members would.

File-scope declarations#

// How two segments meet. Bounded means they cross WITHIN both segments;
// Unbounded means their infinite extensions cross but the segments do not.
enum class ICoreLineIntersection {
    None,
    Unbounded,
    Bounded,
};

ICoreLine.h#

src/ICoreEssentials/UI/Geometry/ICoreLine.h

ICoreLine#

ICoreLine.h:24 · class · 17 declaration(s)

A segment between two model points.

class ICoreLine {
public:
    ICoreLine();

    ICoreLine(const ICorePoint& p1, const ICorePoint& p2);

    ICoreLine(double x1, double y1, double x2, double y2);

    ICoreLine(const QLineF& line);

    [[nodiscard]] ICorePoint p1() const;

    [[nodiscard]] ICorePoint p2() const;

    [[nodiscard]] double x1() const;
    [[nodiscard]] double y1() const;
    [[nodiscard]] double x2() const;
    [[nodiscard]] double y2() const;

    [[nodiscard]] double dx() const;

    [[nodiscard]] double dy() const;

    [[nodiscard]] double length() const;

    // The point `t` of the way from p1 to p2 (t in [0,1] stays on the segment,
    // outside it extrapolates), matching QLineF::pointAt.
    [[nodiscard]] ICorePoint pointAt(double t) const;

    [[nodiscard]] ICorePoint center() const;

    [[nodiscard]] QLineF toQLineF() const;

    // Four doubles. Public so the .cpp's static_asserts can reach them -- see
    // ICoreSizeF.h.
    static constexpr std::size_t kStateSize  = 4 * sizeof(double);
    static constexpr std::size_t kStateAlign = alignof(double);

};

ICoreMargins.h#

src/ICoreEssentials/UI/Geometry/ICoreMargins.h

ICoreMargins#

ICoreMargins.h:12 · class · 9 declaration(s)

Content insets (left/top/right/bottom).

class ICoreMargins {
public:
    ICoreMargins();

    ICoreMargins(int left, int top, int right, int bottom);

    ICoreMargins(const QMargins& margins);

    [[nodiscard]] int left() const;
    [[nodiscard]] int top() const;
    [[nodiscard]] int right() const;
    [[nodiscard]] int bottom() const;

    [[nodiscard]] QMargins toQMargins() const;

    // Four ints. Public so the .cpp's static_asserts can reach them -- see
    // ICoreSizeF.h.
    static constexpr std::size_t kStateSize  = 4 * sizeof(int);
    static constexpr std::size_t kStateAlign = alignof(int);

};

ICoreRectConversion.h#

src/ICoreEssentials/UI/Geometry/ICoreRectConversion.h

ICoreRect deliberately carries NO out-conversion ("NOTHING CONVERTS OUT" -- its Rule 3 note): when B28 landed, no rect crossed back into Qt-declared API. The wrapper layer changed that -- ICorePainter and friends hand rects to Qt constantly -- but ICoreEssentials is frozen, so the conversion lives here as a free function instead of growing the class. WRAPPER ZONE ONLY: client code has no business converting, that is what the wrappers are for.

Declares no class of its own — see the file.

ICoreSizeF.h#

src/ICoreEssentials/UI/Geometry/ICoreSizeF.h

ICoreSizeF#

ICoreSizeF.h:26 · class · 15 declaration(s)

A width/height pair crossing the wrapper boundary.

class ICoreSizeF {
public:
    ICoreSizeF();

    ICoreSizeF(double width, double height);

    ICoreSizeF(const QSizeF& size);

    ICoreSizeF(const QSize& size);

    [[nodiscard]] double width() const;

    [[nodiscard]] double height() const;

    void setWidth(double width);

    void setHeight(double height);

    [[nodiscard]] bool isEmpty() const;

    // "Nobody assigned this size", as distinct from isEmpty()'s "this size
    // covers no pixels". The default constructor leaves QSizeF's own -1/-1
    // invalid marker, so a default-constructed ICoreSizeF answers false here
    // and a deliberate 0x0 answers TRUE -- which is the whole point of having
    // both tests. ICoreWidget::preferredSize() is the first caller: it uses an
    // invalid return as "I have no opinion, ask the toolkit", and a widget that
    // genuinely wants to collapse to nothing has to be able to say 0x0 without
    // that being read as silence. Same predicate as QSizeF::isValid().
    [[nodiscard]] bool isValid() const;

    // Both axes scaled by `factor` -- the toolkit's QSizeF * qreal, as a
    // member since the one spelling call sites use is `size * 0.5`.
    [[nodiscard]] ICoreSizeF operator*(double factor) const;

    // The largest size with THIS aspect ratio that fits inside `box` --
    // QSizeF::scaled(box, Qt::KeepAspectRatio), delegated rather than
    // reimplemented so the edge cases (zero extents return `box`) stay
    // pinned to the toolkit's. No mode parameter: this is the one shape a
    // call site asks for (§9's rule against speculative modes).
    [[nodiscard]] ICoreSizeF scaledToFit(const ICoreSizeF& box) const;

    [[nodiscard]] QSizeF toQSizeF() const;

    [[nodiscard]] QSize toQSize() const;

    // Two doubles. Public so the .cpp's static_asserts can reach them, exactly
    // as ICoreColor does -- a namespace-scope static_assert is not a member and
    // cannot see a private constant.
    static constexpr std::size_t kStateSize  = 2 * sizeof(double);
    static constexpr std::size_t kStateAlign = alignof(double);

};

ICoreVector2.h#

src/ICoreEssentials/UI/Geometry/ICoreVector2.h

ICoreVector2#

ICoreVector2.h:17 · class · 13 declaration(s)

A 2-D direction/displacement, distinct from ICorePoint the way QVector2D is distinct from QPointF: vectors are added, scaled and normalized; points are positions.

class ICoreVector2 {
public:
    ICoreVector2();

    ICoreVector2(double x, double y);

    explicit ICoreVector2(const ICorePoint& point);

    [[nodiscard]] double x() const;
    [[nodiscard]] double y() const;

    [[nodiscard]] double length() const;

    [[nodiscard]] ICoreVector2 normalized() const;

    [[nodiscard]] static double dotProduct(const ICoreVector2& a, const ICoreVector2& b);

    [[nodiscard]] ICorePoint toPoint() const;

    [[nodiscard]] ICoreVector2 operator+(const ICoreVector2& o) const;
    [[nodiscard]] ICoreVector2 operator-(const ICoreVector2& o) const;
    [[nodiscard]] ICoreVector2 operator*(double s) const;

    // Two doubles. Public so the .cpp's static_asserts can reach them -- see
    // ICoreSizeF.h.
    static constexpr std::size_t kStateSize  = 2 * sizeof(double);
    static constexpr std::size_t kStateAlign = alignof(double);

};