source: 2014/30/MiskaK/The Reclaim/The Reclaim/The Reclaim/The Reclaim/Area.cs @ 5689

Revision 5480, 880 bytes checked in by anlakane, 6 years ago (diff)

Lisätty Reclaim versionhallintaan

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Jypeli;
6
7public class Area
8{
9    public Vector FirstCorner { get; set; }
10
11    public Vector SecondCorner { get; set; }
12
13    public Area(Vector firstCorner, Vector secondCorner)
14    {
15        FirstCorner = firstCorner;
16        SecondCorner = secondCorner;
17    }
18
19    /// <summary>
20    /// Onko piste alueen sisällä.
21    /// </summary>
22    /// <param name="pos">Piste.</param>
23    /// <returns>Onko piste alueen sisällä.</returns>
24    public bool IsInside(Vector pos)
25    {
26        if (pos.X < Math.Min(FirstCorner.X, SecondCorner.X) || pos.X > Math.Max(FirstCorner.X, SecondCorner.X)) return false;
27        if (pos.Y < Math.Min(FirstCorner.Y, SecondCorner.Y) || pos.Y > Math.Max(FirstCorner.Y, SecondCorner.Y)) return false;
28        return true;
29    }
30}
Note: See TracBrowser for help on using the repository browser.