Skip to content

Implementation of PVector.setHeading() #193

Closed
@processing-bot

Description

@processing-bot

Created by: arijit4

There's an method named PVector.setHeading() in p5.Vector class of p5.js to set the direction of an vector to any given angle. But there's no such option in Processing. It can be settled down easily. But the function seems more self explanatory and easy to understand. It also goes well with the PVector.heading() method already present in Processing.

An implementation might look like the following :

void setHeading(float angle) {
    this.rotate(angle - this.heading());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions