-
Notifications
You must be signed in to change notification settings - Fork 0
/
Useful.cs
25 lines (24 loc) · 1.56 KB
/
Useful.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;//удалить
namespace raytraicing
{
public class Useful
{
public static double sqr(double X) { return X * X; }
public static float sqr(float X) { return X * X; }
public static int sqr(int X) { return X * X; }
public static float vect_length(PointF Vect) { return (float)Math.Sqrt(sqr(Vect.X) + sqr(Vect.Y)); }
public static double vect_length(Point2DD Vect) { return Math.Sqrt(sqr(Vect.X) + sqr(Vect.Y)); }
public static float vect_length(PointF Vect1, PointF Vect2) { return (float)Math.Sqrt(sqr(Vect1.X - Vect2.X) + sqr(Vect1.Y - Vect2.Y)); }
public static double vect_length(Point2D Vect1, Point2D Vect2) { return Math.Sqrt(sqr(Vect1.X - Vect2.X) + sqr(Vect1.Y - Vect2.Y)); }
public static double vect_length(Point2DD Vect1, Point2D Vect2) { return Math.Sqrt(sqr(Vect1.X - Vect2.X) + sqr(Vect1.Y - Vect2.Y)); }
public static double vect_length(Point2DD Vect1, Point2DD Vect2) { return Math.Sqrt(sqr(Vect1.X - Vect2.X) + sqr(Vect1.Y - Vect2.Y)); }
public static PointF UVect(PointF Vect) { return new PointF(Vect.X / Useful.vect_length(Vect), Vect.Y / Useful.vect_length(Vect)); }
public static Point2DD UVect(Point2DD Vect) { return new Point2DD(Vect.X / Useful.vect_length(Vect), Vect.Y / Useful.vect_length(Vect)); }
public static double VectorMulti(Point2DD Vect1, Point2DD Vect2) { return Vect1.X * Vect2.Y - Vect2.X * Vect1.Y; }
}
}