Skip to content

[2.0] Stabilize w field of p5.VectorΒ #8154

@GregStanton

Description

@GregStanton

[2.0] Stabilize w field of p5.Vector

A task list is below.

1. Decide whether to release (consider confusion and utility):

There are a couple of considerations.

Potential confusion:
Most users, especially beginners, will be unfamiliar with homogeneous coordinates, and will therefore be unfamiliar with the usual $(x, y, z, w)$ naming convention. They may guess that the order of coordinates is alphabetical, and this impression would be reinforced by the alphabetical ordering of the reference entries.

This confusion could be mitigated by clear documentation on the x, y, z, and w reference pages. These would need to be clearer than they currently are (right now, the full documentation is simply "The x component of the vector" for x, and is similar for the other components). However, it may not be necessary to release w into the public API (see the next section).

Limited utility?
A proposed Transform class would abstract away the need for homogeneous coordinates, with methods like applyToPoint() and applyToDirection(). These use homogeneous coordinates internally to distinguish points (which can be translated) from directions (which cannot be translated), so the user doesn't ever need to touch a w coordinate. If we think they won't need to use w coordinates, then it may not be worth it to release them into the public API. On the other hand, if we can find practical, concrete use cases that wouldn't already be handled by Transform, then it may make sense to release w to users, since the confusion it might cause may not be especially great.

2. Fix documentation

If we decide not to release w:
We could add a @private tag to its docs.

If we decide to release w:
Currently, a documentation error prevents this feature from appearing in the beta docs. Properties declared with get and set are typically documented by documenting the getter only, using the @type tag, instead of @returns, which is currently used. Once the getter documentation is fixed, the setter documentation may be deleted. At least, I think this should work.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions