Editor/Geometry/ArchCurveNode.cs

A data model for a control point on an architectural curve used in the editor. It stores position, normal, in/out tangents, tangent mode, roll and width scale, and can copy itself or be constructed at a position.

using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;

namespace Sunless.Architecture;

public enum ArchTangentMode
{
	Auto,
	Linear,
	Mirrored,
	Split
}

public sealed class ArchCurveNode
{
	public int Id { get; set; }
	public Vector3 Position { get; set; }
	public Vector3 Normal { get; set; }
	public Vector3 In { get; set; }
	public Vector3 Out { get; set; }
	public ArchTangentMode Mode { get; set; } = ArchTangentMode.Auto;
	public float Roll { get; set; }
	public float WidthScale { get; set; } = 1f;

	public ArchCurveNode Copy()
	{
		return new ArchCurveNode
		{
			Id = Id,
			Position = Position,
			Normal = Normal,
			In = In,
			Out = Out,
			Mode = Mode,
			Roll = Roll,
			WidthScale = WidthScale
		};
	}

	public static ArchCurveNode At( Vector3 position ) => new() { Position = position };
}