-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #518 from nature-of-code/notion-update-docs
[Notion] Update docs
- Loading branch information
Showing
13 changed files
with
63 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 11 additions & 15 deletions
26
content/examples/05_steering/5_6_path_segments_only/path.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
class Path { | ||
|
||
constructor() { | ||
this.radius = 20; | ||
//{!1} A Path is now an ArrayList of points (PVector objects). | ||
//{!1} A path is now an array of points (p5.Vector objects). | ||
this.points = []; | ||
} | ||
|
||
// This function allows us to add points to the path. | ||
//{!4} This method allows us to add points to the path. | ||
addPoint(x, y) { | ||
let point = createVector(x, y); | ||
this.points.push(point); | ||
let pathPoint = createVector(x, y); | ||
this.points.push(pathPoint); | ||
} | ||
|
||
//{!9} Display the path as a series of points. | ||
show() { | ||
|
||
// Draw thick line for radius | ||
//{!8} Draw a thicker gray line for the path radius. | ||
stroke(200); | ||
strokeWeight(this.radius * 2); | ||
noFill(); | ||
beginShape(); | ||
for (let i = 0; i < this.points.length; i++) { | ||
vertex(this.points[i].x, this.points[i].y); | ||
for (let pathPoint of this.points) { | ||
vertex(pathPoint.x, pathPoint.y); | ||
} | ||
endShape(); | ||
|
||
// Draw thin line for center of path | ||
//{!7} Draw a thin line for the path center. | ||
stroke(0); | ||
strokeWeight(1); | ||
noFill(); | ||
beginShape(); | ||
for (let i = 0; i < this.points.length; i++) { | ||
vertex(this.points[i].x, this.points[i].y); | ||
for (let pathPoint of this.points) { | ||
vertex(pathPoint.x, pathPoint.y); | ||
} | ||
endShape(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters