![]() ![]() For example, T may be a timestamp and ΔT may be a time difference, or T may be an orientation and ΔT may be a rotation. Note that T and ΔT may be the same type, but sometimes they are different. My guide to hexagonal grids uses interpolation to draw lines on a hex grid. T can be a number, a 2d point, a 3d point, an angle, a time, a color, or other things too. We can do interpolation on any vector space. For points, d.x = a.x - b.x d.y = a.y - b.y multiplication by scalar e = k * d where d: ΔT, e: ΔT, and k: number. For points, b.x = a.x + d.x b.y = a.y + d.y subtraction d = a - b where a: T, b: T, and d: ΔT. ![]() How about other types T? We need these operations to define interpolation: addition b = a + d where a: T, b: T, and d: ΔT. I defined the lerp function to interpolate between two numbers, and then I defined lerp_point to work on two points. Return new Point(Math.round(p.x), Math.round(p.y)) Return Math.max(Math.abs(dx), Math.abs(dy)) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |