elect
12/01/2021, 2:06 PMval a = Vec3()
val b = (a + 1) / 2
a + 1
will generate another Vec3
and so will / 2
.
This normally isn't the end of the world, but in specific situations, such as real time 3d graphics, embedded devices, hotspots, etc etc this may be an issue.
Googling around for ideas, I saw that also @Aleksei Dievskii in its viktor had this burden to deal with.
So I was wondering if there might be some solution involving some new language paradigms or features..Aleksei Dievskii
12/01/2021, 2:14 PMJoffrey
12/01/2021, 4:06 PMinline fun Vec3.mapCoordinates(transform: (Int) -> Int): Vec3 = Vec3(
x = transform(x),
y = transform(y),
z = transform(z),
)
This way users can perform this operation a bit more efficiently by creating a single output object:
val a = Vec3()
val b = a.mapCoordinates { (it + 1) / 2 }
But of course this is not a general solutionelect
12/02/2021, 6:39 AMjimn
12/02/2021, 7:14 PM@intrinsic
features.elizarov
12/03/2021, 12:46 PMelect
12/05/2021, 8:35 AMelizarov
12/07/2021, 4:35 PMelect
12/07/2021, 4:37 PMelizarov
12/07/2021, 4:42 PMelizarov
12/08/2021, 3:14 PM