UltimateZoneBuilder/Source/Core/GZBuilder/Geometry/Line3D.cs
MaxED 527d3cf5dc Added, Things mode, Visual mode: event lines for InterpolationPoints are now curved when appropriate setting is enabled in the control thing (PathFollower/ActorMover/MovingCamera) [heavily inspired by Xabis' patch].
Added, Things mode: the editor will try to reconnect the path when deleting InterpolationPoints and PatrolPoints.
Internal: RenderArrows method now works the same way in Renderer2D and Renderer3D.
Internal: Line3D now has "renderarrowhead" property.
2015-08-08 21:56:43 +00:00

58 lines
1.3 KiB
C#

using System;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Rendering;
namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{
public class Line3D
{
// Coordinates
public Vector3D v1;
public Vector3D v2;
public PixelColor color;
public readonly bool renderarrowhead;
// Constructors
public Line3D(Vector3D v1, Vector3D v2)
{
this.v1 = v1;
this.v2 = v2;
this.color = General.Colors.InfoLine;
this.renderarrowhead = true;
}
public Line3D(Vector3D v1, Vector3D v2, bool renderarrowhead)
{
this.v1 = v1;
this.v2 = v2;
this.color = General.Colors.InfoLine;
this.renderarrowhead = renderarrowhead;
}
public Line3D(Vector3D v1, Vector3D v2, PixelColor color)
{
this.v1 = v1;
this.v2 = v2;
this.color = color;
this.renderarrowhead = true;
}
public Line3D(Vector3D v1, Vector3D v2, PixelColor color, bool renderarrowhead)
{
this.v1 = v1;
this.v2 = v2;
this.color = color;
this.renderarrowhead = renderarrowhead;
}
public Vector3D GetDelta() { return v2 - v1; }
// This calculates the angle
public float GetAngle()
{
// Calculate and return the angle
Vector2D d = GetDelta();
return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
}
}
}