/* * Copyright(c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; namespace Tizen.NUI { /// /// A 3D parametric curve.
/// Paths can be used to animate the position and orientation of actors.
///
public class Path : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Path_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } /// /// Dispose /// /// The dispoase type /// 3 protected override void Dispose(DisposeTypes type) { if(disposed) { return; } if(type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. //You should release all of your own disposable objects here. } //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NDalicPINVOKE.delete_Path(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } base.Dispose(type); } internal class Property { internal static readonly int POINTS = NDalicPINVOKE.Path_Property_POINTS_get(); internal static readonly int CONTROL_POINTS = NDalicPINVOKE.Path_Property_CONTROL_POINTS_get(); } /// /// Creates an initialized path handle. /// /// 3 public Path() : this(NDalicPINVOKE.Path_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Please do not use! this will be deprecated /// /// 3 [Obsolete("Please do not use! this will be deprecated")] public static Path DownCast(BaseHandle handle) { Path ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Path; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Adds an interpolation point. /// /// The new interpolation point to be added. /// 3 public void AddPoint(Position point) { NDalicPINVOKE.Path_AddPoint(swigCPtr, Position.getCPtr(point)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Adds a control point. /// /// The new control point to be added. /// 3 public void AddControlPoint(Vector3 point) { NDalicPINVOKE.Path_AddControlPoint(swigCPtr, Vector3.getCPtr(point)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.
/// The generating algorithm is as follows:
/// For a given knot point K[N], find the vector that bisects K[N-1],[N] and [N],[N+1].
/// Calculate the tangent vector by taking the normal of this bisector.
/// The in control point is the length of the preceding segment back along this bisector multiplied by the curvature.
/// The out control point is the length of the succeeding segment forward along this bisector multiplied by the curvature.
///
/// The curvature of the spline. 0 gives straight lines between the knots, negative values means the spline contains loops, positive values up to 0.5 result in a smooth curve, positive values between 0.5 and 1 result in looped curves where the loops are not distinct (i.e., the curve appears to be non-continuous), positive values higher than 1 result in looped curves. /// 3 public void GenerateControlPoints(float curvature) { NDalicPINVOKE.Path_GenerateControlPoints(swigCPtr, curvature); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sample path at a given progress. Calculates the position and tangent at that point of the curve. /// /// A floating point value between 0.0 and 1.0. /// The interpolated position at that progress. /// The interpolated tangent at that progress. /// 3 public void Sample(float progress, Vector3 position, Vector3 tangent) { NDalicPINVOKE.Path_Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// An accessor for the interpolation points. /// /// The index of the interpolation point. /// 3 public Vector3 GetPoint(uint index) { Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetPoint(swigCPtr, index), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// An accessor for the control points. /// /// The index of the control point. /// 3 public Vector3 GetControlPoint(uint index) { Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetControlPoint(swigCPtr, index), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Gets the number of interpolation points in the path. /// /// The number of interpolation points in the path. /// 3 public uint GetPointCount() { uint ret = NDalicPINVOKE.Path_GetPointCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Enumeration for the Points. /// /// 3 public PropertyArray Points { get { Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp); return temp; } set { Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value)); } } /// /// Enumeration for the ControlPoints. /// /// 3 public PropertyArray ControlPoints { get { Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.CONTROL_POINTS).Get(temp); return temp; } set { Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value)); } } } }