processing / processing/processing-website

Confusing example for PVector copy() method

Đang mở
#577 2 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Examples Good First Issue Help Wanted
Ngôn ngữ chính
MDX
Star
90
Fork
122
Merge trung bình
1 giờ 43 phút
Pull request đã merge (30 ngày)
3

Mô tả

Select the type of content error.

Other content error (please specify)

Section

Examples

Location of the error

https://processing.org/reference/PVector_copy_.html

Describe the error

In the documentation for the copy() method of the PVector class, the following code example is given:

PVector v1, v2;

void setup() {
  size(100, 100);
  v1 = new PVector(20.0, 30.0, 40.0);
  v2 = new PVector();
  v2 = v1.copy();
  ...

While not a factual error, it seems curious to me that v2 would be instantiated as a new PVector only to be assigned the result of v1.copy(). If .copy() creates a returns a new PVector object, then the initial assignment would have no effect. This led to some confusion amongst my students who had various incorrect assumptions about how .copy() works given the example code.

Suggested correction
PVector v1, v2;

void setup() {
  size(100, 100);
  v1 = new PVector(20.0, 30.0, 40.0);
  v2 = v1.copy();
  ...
Language

No response

Screenshots or references

No response

Additional context

No response

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu tại trang tham chiếu PVector copy() được liên kết trong issue và tìm phần Examples. Kiểm tra việc khởi tạo đối tượng và phép gán bản sao trong ví dụ, sau đó cập nhật ví dụ để không còn thực hiện việc khởi tạo dư thừa. Xác minh ví dụ tài liệu đã được render sau khi thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.