CST 325 - Graphic Programming (Week 1)
Vector & Ray Intersections
Concepts:
Concepts for this week:
- Vector: concept, history, addition, scaling.
- Magnitude vector’s length. Unit vector is a vector with magnitude of one after Normalization.
- Dot Product: 2 equivalent forms with range [-1,1] to determine the vector’s direction. Useful in detection and lighting.
- Bezier Curve: developed in the 1960s, based on theory of vectors and Lambert terms.
- Ray – Sphere Intersection: three cases (2-1-0 intersections). Using quadratic formula to find the alpha and calculate the point of intersection.
Application:
As
the first week of CST 325 and this is also my first time fully working with
JavaScript and Visual Studio Code, it took me a while to set up the working
environment and became familiar. Plus, I found that running the test cases on
html was new and quite a fascinating experience.
Thanks
to the lecture videos, I did not have many problems starting with vector3.js
file. Taking notes carefully, revealing the materials with ChatGPT, working and
testing thoroughly, it didn’t take long for me to complete the vector3.js. Of
course, like Dark Soul or Elden Ring, that was only the Phase One of the boss.
Sphere.js was Phase Two and it wasn’t easy.
First,
using the debugging tool (F12 on web browser), I was able to solve some test
cases where the default sphere could not clone an invalid parameter. Then,
looking over my note on ray – sphere intersection as well as the Professor’s
recommendation, I mapped out what I need to do with ray( ) function. After
writing the code, I used ChatGPT as well as a 3D Map to help me visualize and
solve the problem. Thanks to that, I have a deeper understanding of the
quadratic formula and dot product used to calculate the intersection.
The
code ran but there was a problem with normalization for the intersecting point.
So, as usual, I looked at the test cases to check what the expectations were. I
came up with a solution to solve all the test cases, but it wasn’t pretty.
Then, my partner and I met on Zoom on Friday’s afternoon. I helped her with
LiveShare and submitting the work, while she helped with the code. Her solution
for normalization is cleaner, so I decided to follow suit.
Overall,
this programming assignment was not crazy hard, but it’s still a challenge.
However, thanks to all the tools and support available, I didn’t have much
problem with it. In fact, it was enjoyable experiencing with new partner as
well as with ChatGPT, even though this is not the first time I use AI as a
studying tool.
.jpeg)
.jpeg)
.png)
Comments
Post a Comment