레퍼런스 transformPoint()

transformPoint()

이 API는 실험적입니다

향후 p5.js 버전에서 동작이 변경될 수 있습니다.

Applies a p5.strands transform to a position.

A transform is a matrix, and moving a point with it means multiplying the two together. Doing that by hand needs an extra 1 tacked onto the end of the position first, and the extra component stripped off the answer. transformPoint() takes care of both steps.

With a 2D transform from transform2D(), pass a two-component position and a two-component position comes back. With a 3D transform from transform3D(), pass a three-component position and a three-component position comes back.

Use transformNormal() for surface directions instead, since those must ignore the move part of a transform.

Note: transformPoint() can only be used inside a p5.strands shader callback.

예제

구문

transformPoint(transform, point)

매개변수

transform
a transform created with transform2D() or transform3D().
point
the position to move.

반환값

the moved position, with as many components as the one passed in.

관련 레퍼런스