
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@brendangooch/bezier
Advanced tools
a typescript class representing a bezier curve
With the QuadraticBezier class you can set 3 control points (start, control, end) and retrieve the any point on the bezier at any given t value between (and beyond) 0 - 1.
You can retrieve a rough approximation of the curve length and move to a distance on the curve rather than a t value.
Additionally, you can set the control point by angle (in radians) and distance from the start point or make the curve a straight line by calling makeStraight().
Finally, you can also retrive a unit vector that is tangent to the curve at any given t value
// basic usage
const bezier = new QuadraticBezier();
bezier.setStart(100, 800);
bezier.setEnd(800, 800);
bezier.setControl(550, 100);
// retriece the point 10% along the curve
bezier.setT(0.1);
const x = bezier.x;
const y = bezier.y;
// retrieve the tangent vector of the curve at 10%
const tangent = bezier.tangent
// move along the curve by distance instead of t for more accurate traversal
bezier.refreshLookup();
// get total length
const length = bezier.length;
// move 500 units along the curve
bezier.setDistance(500);
const x = bezier.x;
const y = bezier.y;
// set control point as an angle and distance away from the start point
bezier.setStart(100, 800);
bezier.setEnd(800, 800);
bezier.setControlByAngleDistance(Math.PI / 2, 500); // 90 degress, 500 units away
// make the bezier a straight line (much more efficient to use a Vector)
bezier.setStart(100, 800);
bezier.setEnd(800, 800);
bezier.makeStraight();
FAQs
a typescript class representing a bezier curve
We found that @brendangooch/bezier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.