Editor/Output/ArchLocate.Measures.cs

Editor helper methods for computing geometric measures of architecture elements. It provides functions to get a wall's yaw, a fence part's yaw, and delegates to wall section helpers for height and thickness.

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

namespace Sunless.Architecture;

public static partial class ArchLocate
{
	public static float WallYaw( ArchWall wall )
	{
		var direction = wall.Direction;

		return MathF.Atan2( direction.y, direction.x ).RadianToDegree();
	}

	static float FenceYaw( ArchFencePart fence )
	{
		if ( fence.Nodes.Count < 2 )
		{
			return 0f;
		}

		var run = fence.Nodes[^1].Position - fence.Nodes[0].Position;

		return MathF.Atan2( run.y, run.x ).RadianToDegree();
	}

	static float WallHeight( ArchWall wall, ArchRoom room, ArchKit kit ) => ArchWallSection.Height( wall, room, kit );

	static float WallThickness( ArchWall wall, ArchKit kit ) => ArchWallSection.Thickness( wall, kit );
}