mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-15 06:30:57 +00:00
77 lines
1.7 KiB
C#
Executable file
77 lines
1.7 KiB
C#
Executable file
using System;
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
namespace CodeImp.DoomBuilder.Geometry
|
|
{
|
|
public class Line3D
|
|
{
|
|
// Coordinates
|
|
public Vector3D Start;
|
|
public Vector3D End;
|
|
public PixelColor Color;
|
|
public readonly bool RenderArrowhead;
|
|
|
|
// Changed by Renderer2D.RenderArrows()
|
|
internal Vector2D Start2D;
|
|
internal Vector2D End2D;
|
|
internal bool SkipRendering;
|
|
|
|
// Constructors
|
|
public Line3D(Vector3D start, Vector3D end)
|
|
{
|
|
this.Start = start;
|
|
this.End = end;
|
|
this.Start2D = start;
|
|
this.End2D = end;
|
|
this.Color = General.Colors.InfoLine;
|
|
this.RenderArrowhead = true;
|
|
}
|
|
|
|
public Line3D(Vector3D start, Vector3D end, bool renderArrowhead)
|
|
{
|
|
this.Start = start;
|
|
this.End = end;
|
|
this.Start2D = start;
|
|
this.End2D = end;
|
|
this.Color = General.Colors.InfoLine;
|
|
this.RenderArrowhead = renderArrowhead;
|
|
}
|
|
|
|
public Line3D(Vector3D start, Vector3D end, PixelColor color)
|
|
{
|
|
this.Start = start;
|
|
this.End = end;
|
|
this.Start2D = start;
|
|
this.End2D = end;
|
|
this.Color = color;
|
|
this.RenderArrowhead = true;
|
|
}
|
|
|
|
public Line3D(Vector3D start, Vector3D end, PixelColor color, bool renderArrowhead)
|
|
{
|
|
this.Start = start;
|
|
this.End = end;
|
|
this.Start2D = start;
|
|
this.End2D = end;
|
|
this.Color = color;
|
|
this.RenderArrowhead = renderArrowhead;
|
|
}
|
|
|
|
public Vector3D GetDelta() { return End - Start; }
|
|
|
|
// This calculates the angle
|
|
public double GetAngle()
|
|
{
|
|
// Calculate and return the angle
|
|
Vector2D d = GetDelta();
|
|
return -Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
|
|
}
|
|
|
|
public double GetAngleZ()
|
|
{
|
|
Vector3D d = GetDelta();
|
|
|
|
return Math.Atan2(Math.Sqrt(d.x*d.x + d.y*d.y), d.z);
|
|
}
|
|
}
|
|
}
|