https://github.com/cllspy/let-it-go
just another Go repo.
https://github.com/cllspy/let-it-go
Last synced: 9 months ago
JSON representation
just another Go repo.
- Host: GitHub
- URL: https://github.com/cllspy/let-it-go
- Owner: CllsPy
- Created: 2024-06-27T01:53:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T22:53:23.000Z (over 1 year ago)
- Last Synced: 2025-04-02T04:29:19.255Z (12 months ago)
- Language: Go
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction
**Ray Tracing** is an algorithm used to create realistic graphics.
## Sub-problem No. 1
Any Ray Tracing algorithm requires the representation of objects in a 3D space.
A vector is a line segment that extends from point A to point B in a 2D or 3D plane.
We need to be able to operate on vectors.
Normalizing a vector involves scaling its magnitude/size to 1 while retaining its direction. This can be useful for other operations such as distance calculation or clustering.
The formula for the cross product is given by:

To implement the calculation, the following steps were taken:
- Create an empty list called `new_result`
- Iterate over the vector `result`
- In each iteration, add the previous value to the next one
- Store this result in `new_result`
- Display `new_result`
To calculate the magnitude of a vector:
### Steps
- Iterate over the vector elements
- Square each element
- Sum the squared values
- Take the square root of the resulting value
### Resources
- `for` loop
- `math.Pow(2, 10)`
- `append`
### Plan
- Iterate over the vector `v1[x]`
- Square each `v1[x]`
- Store the squared values in another vector `[x]`
- Sum the values in this new vector `[x]`
## Useful Links
- [Tour for Go](https://go.dev/tour/moretypes/6) 
- [Vector Representation in Go](https://www.netguru.com/blog/vector-operations-in-go) 
- [Vector Normalization](https://www.khanacademy.org/computing/computer-programming/programming-natural-simulations/programming-vectors/a/vector-magnitude-normalization) 
- [OOP in Golang](https://www.tutorialspoint.com/golang-program-to-create-a-class-and-object#:~:text=Structs%20%E2%88%92%20Go%20language%20does%20not,same%20or%20different%20data%20type.) 
- [Machine Learning with Go: Matrices and Vectors | packtpub.com](https://www.youtube.com/watch?v=rzYzsdKImEs) 
- [Sum Vector JS Solution](https://spellbox.app/spells/javascript/two-functions-that-make-sum-two-vectors-and-make-their-dot-product-in-javascript) 
- [Golang - Append Function](https://dev.to/andyhaskell/a-closer-look-at-go-s-slice-append-function-3bhb) 
- [Passing & Returning Array To & From a Function | Go Tutorial](https://www.youtube.com/watch?v=_mVLhNgQ7_8) 
- [The Vector Product](https://www.mathcentre.ac.uk/resources/uploaded/mc-ty-vectorprod-2009-1.pdf) 