Skip to content

Commit 4fc1c5d

Browse files
authored
Merge pull request #1015 from babaissarkar/update_set_heading
Update docs for setHeading
2 parents b8c0857 + 7d691d8 commit 4fc1c5d

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

core/src/processing/core/PVector.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,13 +848,15 @@ public PVector setMag(PVector target, float len) {
848848

849849
/**
850850
*
851-
* Calculate the angle of rotation for this vector (only 2D vectors)
852-
*
851+
* Calculate the vector's direction, that is, the angle this vector makes
852+
* with the positive X axis (only 2D vectors)
853+
*
853854
*
854855
* @webref pvector:method
855856
* @usage web_application
856-
* @return the angle of rotation
857+
* @return the direction of the vector (angle with positive X axis)
857858
* @webBrief Calculate the angle of rotation for this vector
859+
* @see PVector#setHeading()
858860
*/
859861
public float heading() {
860862
float angle = (float) Math.atan2(y, x);
@@ -867,7 +869,18 @@ public float heading2D() {
867869
return heading();
868870
}
869871

870-
872+
/**
873+
*
874+
* Sets the angle this vector makes with the positive X axis (only 2D vectors)
875+
* This is equivalent to changing the vector's direction to the given value.
876+
*
877+
* @webref pvector:method
878+
* @usage web_application
879+
* @param angle the direction of the resultant vector
880+
* @return this vector, rotated to have the given direction
881+
* @webBrief Set the direction for this vector
882+
* @see PVector#heading()
883+
*/
871884
public PVector setHeading(float angle) {
872885
float m = mag();
873886
x = (float) (m * Math.cos(angle));

java/keywords.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ size FUNCTION2 FloatList_size_
503503
sort FUNCTION2 FloatList_sort_
504504
sortReverse FUNCTION2 FloatList_sortReverse_
505505
sub FUNCTION2 FloatList_sub_
506+
toArray FUNCTION2 FloatList_toArray_
506507
floor FUNCTION1 floor_
507508
focused KEYWORD4 focused
508509
frameCount KEYWORD4 frameCount
@@ -559,6 +560,7 @@ size FUNCTION2 IntList_size_
559560
sort FUNCTION2 IntList_sort_
560561
sortReverse FUNCTION2 IntList_sortReverse_
561562
sub FUNCTION2 IntList_sub_
563+
toArray FUNCTION2 IntList_toArray_
562564
join FUNCTION1 join_
563565
JSONArray KEYWORD5 JSONArray
564566
append FUNCTION2 JSONArray_append_
@@ -579,6 +581,8 @@ setJSONArray FUNCTION2 JSONArray_setJSONArray_
579581
setJSONObject FUNCTION2 JSONArray_setJSONObject_
580582
setString FUNCTION2 JSONArray_setString_
581583
size FUNCTION2 JSONArray_size_
584+
toIntArray FUNCTION2 JSONArray_toIntArray_
585+
toStringArray FUNCTION2 JSONArray_toStringArray_
582586
JSONObject KEYWORD5 JSONObject
583587
getBoolean FUNCTION2 JSONObject_getBoolean_
584588
getFloat FUNCTION2 JSONObject_getFloat_
@@ -751,6 +755,7 @@ random2D FUNCTION2 PVector_random2D_
751755
random3D FUNCTION2 PVector_random3D_
752756
rotate FUNCTION2 PVector_rotate_
753757
set FUNCTION2 PVector_set_
758+
setHeading FUNCTION2 PVector_setHeading_
754759
setMag FUNCTION2 PVector_setMag_
755760
sub FUNCTION2 PVector_sub_
756761
quad FUNCTION1 quad_
@@ -847,6 +852,7 @@ shuffle FUNCTION2 StringList_shuffle_
847852
size FUNCTION2 StringList_size_
848853
sort FUNCTION2 StringList_sort_
849854
sortReverse FUNCTION2 StringList_sortReverse_
855+
toArray FUNCTION2 StringList_toArray_
850856
upper FUNCTION2 StringList_upper_
851857
stroke FUNCTION1 stroke_
852858
strokeCap FUNCTION1 strokeCap_
@@ -911,6 +917,13 @@ unbinary FUNCTION1 unbinary_
911917
unhex FUNCTION1 unhex_
912918
updatePixels FUNCTION1 updatePixels_
913919
vertex FUNCTION1 vertex_
920+
windowMove FUNCTION1 windowMove_
921+
windowMoved FUNCTION1 windowMoved_
922+
windowRatio FUNCTION1 windowRatio_
923+
windowResizable FUNCTION1 windowResizable_
924+
windowResize FUNCTION1 windowResize_
925+
windowResized FUNCTION1 windowResized_
926+
windowTitle FUNCTION1 windowTitle_
914927
XML KEYWORD5 XML
915928
addChild FUNCTION2 XML_addChild_
916929
format FUNCTION2 XML_format_

0 commit comments

Comments
 (0)