Skip to content

Commit

Permalink
[Docs]Update instructions.md (#2508)
Browse files Browse the repository at this point in the history
* Update instructions.md

Co-authored-by: Derk-Jan Karrenbeld <[email protected]>

* [CI] Format code

---------

Co-authored-by: Derk-Jan Karrenbeld <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 30, 2024
1 parent 57c712f commit 2b00cf9
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ so you decide to use a function closure to create reusable transformation for `{

Implement the `translate2d` function that returns a function making use of a closure to perform a repeatable 2d translation of a coordinate pair.

> In Geometry, [translation][wiki-translate] refers to moving points, vectors or shapes the same distance in one direction.
> It can be interpreted as addition of a constant to every point.
```javascript
const moveCoordinatesRight2Px = translate2d(2, 0);
const result = moveCoordinatesRight2Px(4, 8);
Expand All @@ -18,6 +21,9 @@ const result = moveCoordinatesRight2Px(4, 8);

Implement the `scale2d` function that returns a function making use of a closure to perform a repeatable 2d scale of a coordinate pair.

> In geometry, uniform [scaling][wiki-scale] refers to enlarging or shrinking vectors or shapes in the same direction.
> It can be interpreted as multiplying every point by a constant (scaling factor).
>
> For this exercise, assume only positive scaling values.
```javascript
Expand Down Expand Up @@ -56,3 +62,6 @@ const memoizedScale = memoizeTransform(tripleScale);
memoizedScale(4, 3); // => [12, 9], this is computed since it hasn't been computed before for the arguments
memoizedScale(4, 3); // => [12, 9], this is remembered, since it was computed already
```

[wiki-translate]: https://en.wikipedia.org/wiki/Translation_(geometry)
[wiki-scale]: https://en.wikipedia.org/wiki/Scaling_(geometry)

0 comments on commit 2b00cf9

Please sign in to comment.