Ejemplo n.º 1
0
 // This tests on which side of the line the given coordinates are
 // returns < 0 for front (right) side, > 0 for back (left) side and 0 if on the line
 public float SideOfLine(LuaVector2D p)
 {
     if (linedef.IsDisposed)
     {
         throw new ScriptRuntimeException("Linedef has been disposed, can't SideOfLine.");
     }
     return(linedef.SideOfLine(p.vec));
 }
Ejemplo n.º 2
0
 public LuaLine2D WithV1(LuaVector2D v1)
 {
     return(new LuaLine2D(new Line2D(
                              v1.vec,
                              l2d.v2.x,
                              l2d.v2.y
                              )));
 }
Ejemplo n.º 3
0
 public LuaLine2D WithV2(LuaVector2D v2)
 {
     return(new LuaLine2D(new Line2D(
                              l2d.v1.x,
                              l2d.v1.y,
                              v2.vec
                              )));
 }
Ejemplo n.º 4
0
 public bool Intersect(LuaVector2D p)
 {
     if (sector.IsDisposed)
     {
         throw new ScriptRuntimeException("Sector has been disposed, can't Intersect()!");
     }
     return(sector.Intersect(p.vec));
 }
Ejemplo n.º 5
0
 public float DistanceTo(LuaVector2D p)
 {
     if (thing.IsDisposed)
     {
         throw new ScriptRuntimeException("Thing has been disposed, can't DistanceTo().");
     }
     return(thing.DistanceTo(p.vec));
 }
Ejemplo n.º 6
0
        public LuaVector2D NearestOnLine(LuaVector2D pos)
        {
            if (linedef.IsDisposed)
            {
                throw new ScriptRuntimeException("Linedef has been disposed, can't NearestOnLine.");
            }

            return(new LuaVector2D(linedef.NearestOnLine(pos.vec)));
        }
Ejemplo n.º 7
0
 public static LuaSidedef NearestSidedef(LuaVector2D pos)
 {
     Sidedef side = MapSet.NearestSidedef(General.Map.Map.Sidedefs, pos.vec);
     if (side == null)
     {
         return null;
     }
     return new LuaSidedef(side);
 }
Ejemplo n.º 8
0
 public static LuaVector2D SnappedToAccuracy(LuaVector2D v)
 {
     return(new LuaVector2D(
                new Vector2D(
                    (float)Math.Round(v.vec.x, General.Map.FormatInterface.VertexDecimals),
                    (float)Math.Round(v.vec.y, General.Map.FormatInterface.VertexDecimals)
                    )
                ));
 }
Ejemplo n.º 9
0
 public static LuaThing NearestThing(LuaVector2D pos)
 {
     Thing t = MapSet.NearestThing(General.Map.Map.Things, pos.vec);
     if (t == null)
     {
         return null;
     }
     return new LuaThing(t);
 }
Ejemplo n.º 10
0
 public static LuaVertex NearestVertex(LuaVector2D pos)
 {
     Vertex v = MapSet.NearestVertex(General.Map.Map.Vertices, pos.vec);
     if (v == null)
     {
         return null;
     }
     return new LuaVertex(v);
 }
Ejemplo n.º 11
0
 public static LuaLinedef NearestLinedefRange(LuaVector2D pos, float range)
 {
     Linedef l = MapSet.NearestLinedefRange(General.Map.Map.Linedefs, pos.vec, range);
     if (l == null)
     {
         return null;
     }
     return new LuaLinedef(l);
 }
Ejemplo n.º 12
0
 public static LuaLinedef NearestLinedef(LuaVector2D pos)
 {
     Linedef l = MapSet.NearestLinedef(General.Map.Map.Linedefs, pos.vec);
     if (l == null)
     {
         return null;
     }
     return new LuaLinedef(l);
 }
Ejemplo n.º 13
0
        public float DistanceTo(LuaVector2D p, bool bounded)
        {
            if (linedef.IsDisposed)
            {
                throw new ScriptRuntimeException("Linedef has been disposed, can't DistanceTo.");
            }

            return(linedef.DistanceTo(p.vec, bounded));
        }
Ejemplo n.º 14
0
 public static LuaSector NearestSector(LuaVector2D pos)
 {
     Sidedef nearest_sidedef = MapSet.NearestSidedef(General.Map.Map.Sidedefs, pos.vec);
     if (nearest_sidedef == null)
     {
         return null;
     }
     Sector sector = nearest_sidedef.Sector;
     if (sector == null)
     {
         return null;
     }
     return new LuaSector(sector);
 }
Ejemplo n.º 15
0
 public bool TryToMove(LuaVector2D v)
 {
     return(TryToMove(v.x, v.y));
 }
Ejemplo n.º 16
0
 public static Pen From(LuaVector2D v)
 {
     return(new Pen(v));
 }
Ejemplo n.º 17
0
 public void MoveDiagonal(LuaVector2D v)
 {
     position.vec += v.vec.GetRotated(angle);
 }
Ejemplo n.º 18
0
 public void DrawVertexAt(LuaVector2D newVec)
 {
     AddVertexAt(newVec.vec, true, snaptogrid, stitchrange, drawnVertices);
 }
Ejemplo n.º 19
0
 public void DrawVertexAt(LuaVector2D newVec, bool snaptonearest, bool snaptogrid)
 {
     AddVertexAt(newVec.vec, snaptonearest, snaptogrid, stitchrange, drawnVertices);
 }
Ejemplo n.º 20
0
 public static float Distance(LuaVector2D a, LuaVector2D b)
 {
     return(Vector2D.Distance(a.vec, b.vec));
 }
Ejemplo n.º 21
0
 public static float ManhattanDistance(LuaVector2D a, LuaVector2D b)
 {
     return(Vector2D.ManhattanDistance(a.vec, b.vec));
 }
Ejemplo n.º 22
0
 public static LuaLine2D From(LuaVector2D v, float x2, float y2)
 {
     return(new LuaLine2D(new Line2D(v.vec, x2, y2)));
 }
Ejemplo n.º 23
0
 public static float GetAngle(LuaVector2D a, LuaVector2D b)
 {
     return(Vector2D.GetAngle(a.vec, b.vec));
 }
Ejemplo n.º 24
0
 public static LuaVector2D Reversed(LuaVector2D r)
 {
     return(new LuaVector2D(Vector2D.Reversed(r.vec)));
 }
Ejemplo n.º 25
0
 public static LuaVector2D SnappedToGrid(LuaVector2D v)
 {
     return(new LuaVector2D(General.Map.Grid.SnappedToGrid(v.vec)));
 }
Ejemplo n.º 26
0
 public static LuaVector2D Reflect(LuaVector2D v, LuaVector2D m)
 {
     return(new LuaVector2D(Vector2D.Reflect(v.vec, m.vec)));
 }
Ejemplo n.º 27
0
 public static LuaVector2D CrossProduct(LuaVector2D a, LuaVector2D b)
 {
     return(new LuaVector2D(Vector2D.CrossProduct(a.vec, b.vec)));
 }
Ejemplo n.º 28
0
 public static float DotProduct(LuaVector2D a, LuaVector2D b)
 {
     return(Vector2D.DotProduct(a.vec, b.vec));
 }
Ejemplo n.º 29
0
 public static LuaLine2D From(float x1, float y1, LuaVector2D v)
 {
     return(new LuaLine2D(new Line2D(x1, y1, v.vec)));
 }
Ejemplo n.º 30
0
 public static LuaLine2D From(LuaVector2D v1, LuaVector2D v2)
 {
     return(new LuaLine2D(new Line2D(v1.vec, v2.vec)));
 }