好的,所以我有这门课
public sealed class LightSource
{
public readonly Point3D Source;
public readonly Point3D Direction;
public readonly float ConeAngle;
public List<Ray> Lights { get; private set; }
public const double MaxRadian = 2.0 * Math.PI;
public LightSource(Point3D source, Point3D direction, float coneAngle)
{
this.Source = source;
this.Direction = direction;
if (coneAngle <= 0 || coneAngle > LightSource.MaxRadian)
{
throw new ArgumentException("coneAngle <= 0 || coneAngle > LightSource.MaxRadian");
}
this.ConeAngle = coneAngle;
this.Lights = LightSource.GenerateLights(this.Source, this.Direction, this.ConeAngle);
}
public static List<Ray> GenerateLights(Point3D source, Point3D direction, float coneAngle)
{
//How would i do this?
}
}
我将如何实现 GenerateLights 方法来给我一个在我的锥角内的光线列表。可以说光线的数量是恒定的。谢谢你。