@@ -231,6 +231,178 @@ case class Vec2i(x: Int, y: Int) extends Int2 with VecInt[Vec2i] with VecAsFloat
231231
232232 override def lengthSquared : Int = this dot this
233233
234+ /**
235+ * Returns the angle in radians between this vector and the one with the given components.
236+ *
237+ * @param x X component of the second vector
238+ * @param y Y component of the second vector
239+ * @return The angle in radians between this vector and the one with the given components
240+ */
241+ def angle (x : Double , y : Double ): Double = this .angle(Vec2d (x, y))
242+
243+ /**
244+ * Returns the normalized vector pointing from this vector to the one with the given components.
245+ *
246+ * Using `a.directionTo(b)` is equivalent to using `(b - a).normalized`.
247+ *
248+ * @param x X component of the second vector
249+ * @param y Y component of the second vector
250+ * @return The normalized vector pointing from this vector to the given one
251+ */
252+ def directionTo (x : Double , y : Double ): Vec2d = this .directionTo(Vec2d (x, y))
253+
254+ /**
255+ * Returns the squared distance between this vector and the one with the given components.
256+ *
257+ * Using `a.distanceSquaredTo(b)` is equivalent to using `(b - a).lengthSquared`.
258+ *
259+ * @param x X component of the second vector
260+ * @param y Y component of the second vector
261+ * @return The squared distance between this vector and the one with the given components
262+ */
263+ def distanceSquaredTo (x : Int , y : Int ): Int = this .distanceSquaredTo(Vec2i (x, y))
264+
265+ /**
266+ * Returns the squared distance between this vector and the one with the given components.
267+ *
268+ * Using `a.distanceSquaredTo(b)` is equivalent to using `(b - a).lengthSquared`.
269+ *
270+ * @param x X component of the second vector
271+ * @param y Y component of the second vector
272+ * @return The squared distance between this vector and the one with the given components
273+ */
274+ def distanceSquaredTo (x : Float , y : Float ): Float = this .distanceSquaredTo(Vec2f (x, y))
275+
276+ /**
277+ * Returns the squared distance between this vector and the one with the given components.
278+ *
279+ * Using `a.distanceSquaredTo(b)` is equivalent to using `(b - a).lengthSquared`.
280+ *
281+ * @param x X component of the second vector
282+ * @param y Y component of the second vector
283+ * @return The squared distance between this vector and the one with the given components
284+ */
285+ def distanceSquaredTo (x : Double , y : Double ): Double = this .distanceSquaredTo(Vec2d (x, y))
286+
287+ /**
288+ * Returns the distance between this vector and the one with the given components.
289+ *
290+ * Using `a.distanceTo(b)` is equivalent to using `(b - a).length`.
291+ *
292+ * @param x X component of the second vector
293+ * @param y Y component of the second vector
294+ * @return The distance between this vector and the one with the given components
295+ */
296+ def distanceTo (x : Double , y : Double ): Double = this .distanceTo(Vec2d (x, y))
297+
298+ /**
299+ * Returns this vector reflected from a plane defined by the given normal (must be normalized).
300+ *
301+ * @param x X component of the normal
302+ * @param y Y component of the normal
303+ * @return This vector reflected from a plane defined by the given normal
304+ */
305+ def reflect (x : Int , y : Int ): Vec2i = this .reflect(Vec2i (x, y))
306+
307+ /**
308+ * Returns this vector reflected from a plane defined by the given normal (must be normalized).
309+ *
310+ * @param x X component of the normal
311+ * @param y Y component of the normal
312+ * @return This vector reflected from a plane defined by the given normal
313+ */
314+ def reflect (x : Float , y : Float ): Vec2f = this .reflect(Vec2f (x, y))
315+
316+ /**
317+ * Returns this vector reflected from a plane defined by the given normal (must be normalized).
318+ *
319+ * @param x X component of the normal
320+ * @param y Y component of the normal
321+ * @return This vector reflected from a plane defined by the given normal
322+ */
323+ def reflect (x : Double , y : Double ): Vec2d = this .reflect(Vec2d (x, y))
324+
325+ /**
326+ * Returns this vector "bounced off" from a plane defined by the given normal (must be normalized).
327+ *
328+ * @param x X component of the normal
329+ * @param y Y component of the normal
330+ * @return This vector "bounced off" from a plane defined by the given normal
331+ */
332+ def bounce (x : Int , y : Int ): Vec2i = this .bounce(Vec2i (x, y))
333+
334+ /**
335+ * Returns this vector "bounced off" from a plane defined by the given normal (must be normalized).
336+ *
337+ * @param x X component of the normal
338+ * @param y Y component of the normal
339+ * @return This vector "bounced off" from a plane defined by the given normal
340+ */
341+ def bounce (x : Float , y : Float ): Vec2f = this .bounce(Vec2f (x, y))
342+
343+ /**
344+ * Returns this vector "bounced off" from a plane defined by the given normal (must be normalized).
345+ *
346+ * @param x X component of the normal
347+ * @param y Y component of the normal
348+ * @return This vector "bounced off" from a plane defined by the given normal
349+ */
350+ def bounce (x : Double , y : Double ): Vec2d = this .bounce(Vec2d (x, y))
351+
352+ /**
353+ * Returns this vector projected onto the one with the given components.
354+ *
355+ * @param x X component of the vector to project onto
356+ * @param y Y component of the vector to project onto
357+ * @return This vector projected onto the one with the given components
358+ */
359+ def project (x : Int , y : Int ): Vec2i = this .project(Vec2i (x, y))
360+
361+ /**
362+ * Returns this vector projected onto the one with the given components.
363+ *
364+ * @param x X component of the vector to project onto
365+ * @param y Y component of the vector to project onto
366+ * @return This vector projected onto the one with the given components
367+ */
368+ def project (x : Float , y : Float ): Vec2f = this .project(Vec2f (x, y))
369+
370+ /**
371+ * Returns this vector projected onto the one with the given components.
372+ *
373+ * @param x X component of the vector to project onto
374+ * @param y Y component of the vector to project onto
375+ * @return This vector projected onto the one with the given components
376+ */
377+ def project (x : Double , y : Double ): Vec2d = this .project(Vec2d (x, y))
378+
379+ /**
380+ * Returns this vector slid along a plane defined by the normal with the given components.
381+ *
382+ * @param x X component of the normal
383+ * @param y Y component of the normal
384+ * @return This vector slid along a plane defined by the given normal
385+ */
386+ def slide (x : Int , y : Int ): Vec2i = this .slide(Vec2i (x, y))
387+
388+ /**
389+ * Returns this vector slid along a plane defined by the normal with the given components.
390+ *
391+ * @param x X component of the normal
392+ * @param y Y component of the normal
393+ * @return This vector slid along a plane defined by the given normal
394+ */
395+ def slide (x : Float , y : Float ): Vec2f = this .slide(Vec2f (x, y))
396+
397+ /**
398+ * Returns this vector slid along a plane defined by the normal with the given components.
399+ *
400+ * @param x X component of the normal
401+ * @param y Y component of the normal
402+ * @return This vector slid along a plane defined by the given normal
403+ */
404+ def slide (x : Double , y : Double ): Vec2d = this .slide(Vec2d (x, y))
405+
234406 override def toFloat : Vec2f = Vec2f (this .x.toFloat, this .y.toFloat)
235407
236408 override def toDouble : Vec2d = Vec2d (this .x.toDouble, this .y.toDouble)
0 commit comments