// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Utilities
{
///
/// Base Parabola line data provider.
///
public abstract class ParabolaLineDataProvider : BaseMixedRealityLineDataProvider
{
[SerializeField]
private MixedRealityPose startPoint = MixedRealityPose.ZeroIdentity;
///
/// The Starting point of this line.
///
/// Always located at this GameObject's Transform.position
public MixedRealityPose StartPoint => startPoint;
#region Line Data Provider Implementation
///
protected override float GetUnClampedWorldLengthInternal()
{
float distance = 0f;
Vector3 last = GetUnClampedPoint(0f);
for (int i = 1; i < UnclampedWorldLengthSearchSteps; i++)
{
Vector3 current = GetUnClampedPoint((float)i / UnclampedWorldLengthSearchSteps);
distance += Vector3.Distance(last, current);
}
return distance;
}
///
protected override Vector3 GetUpVectorInternal(float normalizedLength)
{
return transform.up;
}
#endregion Line Data Provider Implementation
}
}