Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector cal library #10

Merged
merged 11 commits into from
Aug 27, 2024
Merged

Vector cal library #10

merged 11 commits into from
Aug 27, 2024

Conversation

Tsunghao-C
Copy link
Collaborator

  1. Created a vector module that includes 10 basic vector operations
  • the struct of vector is defined in vector.h, which consists two double number x and y.
  • vec_init(): initialize a vector object with x and y in the argument
  • vec_add(), vec_sub(), vec_muls(): the first vector argument value will change after operation, while the 2nd argument will not be changed
  • vec_mirror(), vec_transpose(): change the vector argument by mirroring or trasponsing
  • vec_rotate(): rotate the vector argument COUNTERCLOCKWISE by angle (in double).
  • vec_dot(), vec_absv(), vec_dist(): returns a double value of inner dot multiplication, absolute value of a vector, or the distance between two vectors.
  1. Added three vector data (p_dir, p_pos, p_cam) in the main data structure

  2. Initialized player position and direction vectors as well when parsing the map.

  3. The positive X direction is defined to be SOUTH and the positive Y direction is define to be EAST

      y y
      | |
      0 1 2 3 4 5 6 7   -> EAST
    

x = 0 1 1 1 1 1 1 1 1
x = 1 1 0 0 0 0 0 0 1
x = 2 1 0 0 0 0 0 1 1
|
SOUTH

@Haliris
Copy link
Owner

Haliris commented Aug 27, 2024

LGTM! 👍

@Haliris Haliris merged commit 8bfd97f into main Aug 27, 2024
2 checks passed
@Haliris Haliris deleted the vector_cal branch August 27, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants