//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Drawing.Paths
{
using System.Linq;
using System.Numerics;
///
/// Represents a series of control points that will be joined by straight lines
///
///
public class LinearLineSegment : ILineSegment
{
///
/// The collection of points.
///
private readonly Vector2[] points;
///
/// Initializes a new instance of the class.
///
/// The start.
/// The end.
public LinearLineSegment(Vector2 start, Vector2 end)
: this(new[] { start, end })
{
}
///
/// Initializes a new instance of the class.
///
/// The points.
public LinearLineSegment(params Vector2[] points)
{
Guard.NotNull(points, nameof(points));
Guard.MustBeGreaterThanOrEqualTo(points.Count(), 2, nameof(points));
this.points = points;
}
///
/// Converts the into a simple linear path..
///
///
/// Returns the current as simple linear path.
///
public Vector2[] AsSimpleLinearPath()
{
return this.points;
}
}
}