Skip to content

feat: implement bezier curve support#102

Open
DongjaJ wants to merge 7 commits into
utilForever:mainfrom
DongjaJ:issue-94-bezier-curve
Open

feat: implement bezier curve support#102
DongjaJ wants to merge 7 commits into
utilForever:mainfrom
DongjaJ:issue-94-bezier-curve

Conversation

@DongjaJ
Copy link
Copy Markdown
Contributor

@DongjaJ DongjaJ commented May 24, 2026

What

Adds Bezier curve evaluation and sampling support to bracket-geometry::Curve, plus documentation and a runnable example.

Why

Bezier curves are requested in issue #94 and provide a reusable way to evaluate curves from existing Curve control points.

Closes #94

Checklist

Required

  • cargo check --all passes
  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings -A clippy::multiple-crate-versions passes
  • cargo test --all passes
  • I linked the related issue (for example: Closes #123)

Functional Validation

  • Behavior related to this change was verified locally (if applicable)
  • Rendering/backend behavior was verified when runtime code changed (if applicable)
  • Algorithm behavior (pathfinding/FOV/noise/random) was verified when affected (if applicable)
  • I added or updated tests for changed behavior (if applicable)

Configuration & Docs

  • User-facing docs were updated (README.md, ARCHITECTURE.md, or relevant manual pages, if applicable)
  • New dependencies/configuration are documented (if applicable)
  • No sensitive values or credentials were introduced

If Applicable

  • Security impact considered (run cargo audit locally if needed)
  • Breaking behavior changes are clearly described in this PR

Local Validation

  • cargo check --all
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings -A clippy::multiple-crate-versions
  • cargo test --all
  • cargo check -p bracket-geometry --example bezier_curve
  • cargo run -p bracket-geometry --example bezier_curve

Summary by CodeRabbit

  • New Features

    • Bezier curve evaluation and sampling capabilities added, enabling point calculation at any parameter value.
    • New visual example demonstrates Bezier curve rendering with control points marked in terminal output.
  • Documentation

    • README expanded with Bezier curve usage examples and execution guidance for the new example.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04ee634a-325b-4760-9978-63943c76d3e8

📥 Commits

Reviewing files that changed from the base of the PR and between fe7bf77 and bd3a1f2.

📒 Files selected for processing (3)
  • bracket-geometry/README.md
  • bracket-geometry/examples/bezier_curve.rs
  • bracket-geometry/src/curve.rs
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Format all Rust code using cargo fmt --all
Fix all cargo clippy warnings — the CI enforces -D warnings
Add tests for new functionality in the relevant module; for split domains, prefer colocated tests.rs

Files:

  • bracket-geometry/examples/bezier_curve.rs
  • bracket-geometry/src/curve.rs
🔇 Additional comments (3)
bracket-geometry/src/curve.rs (1)

1-1: LGTM!

Also applies to: 52-104, 121-251

bracket-geometry/README.md (1)

71-84: LGTM!

bracket-geometry/examples/bezier_curve.rs (1)

1-42: LGTM!


📝 Walkthrough

Walkthrough

This PR extends the Curve type with Bezier evaluation and sampling capabilities. New methods compute individual Bezier points and sample curves into fixed-point grids, backed by comprehensive unit tests. Documentation and a visual example demonstrate the API.

Changes

Bezier Curve Evaluation

Layer / File(s) Summary
Bezier evaluation implementation and tests
bracket-geometry/src/curve.rs
Curve gains bezier_point(t) to evaluate points via iterative reduction, returning None for empty curves or non-finite parameters, and bezier_points(steps) to sample into integer Point vectors. A test helper assert_pointf_eq validates PointF with epsilon tolerance. Tests cover empty/single/linear/quadratic/cubic curves, endpoint matching, non-finite rejection, and sampling bounds.
Documentation and example
bracket-geometry/README.md, bracket-geometry/examples/bezier_curve.rs
README documents Bezier APIs with code examples and a cargo run command. The example initializes a Curve from six control points, samples 160 Bezier points, and renders them with control points onto a fixed-size character grid using crossterm queued output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • utilForever/roguekit#98: Introduced the foundational Curve type that this PR extends with Bezier evaluation methods.

Suggested reviewers

  • utilForever

🐰 A curve springs to life, *
Bezier points dance on the page,
Control flows with grace.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: implement bezier curve support' directly and clearly describes the main change: adding Bezier curve evaluation and sampling functionality to the Curve API, which aligns with the substantial additions to curve.rs, new example, and README documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DongjaJ DongjaJ marked this pull request as ready for review May 24, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bezier Curve 구현

1 participant