32 lines
412 B
V
32 lines
412 B
V
import hash.crc32
|
|
|
|
struct Point {
|
|
x int
|
|
y int
|
|
z int
|
|
}
|
|
|
|
struct Vector {
|
|
x int
|
|
y int
|
|
z int
|
|
ccc crc32.Crc33
|
|
}
|
|
|
|
fn (p Point) translate(v Vector) Point {
|
|
return Point{p.x + v.x, p.y + v.y, p.z + v.z}
|
|
}
|
|
|
|
fn (p Point) identity() Point {
|
|
return Point{1, 1, 1}
|
|
}
|
|
|
|
fn main() {
|
|
p := Point{1, 2, 3}
|
|
v := Vector{x: 5, y: 5, z: 10}
|
|
z := p.tranzlate(v)
|
|
println('p: $p')
|
|
println('v: $v')
|
|
println('z: $z')
|
|
}
|