Skip to content

M_Rhino_Geometry_Collections_NurbsCurvePointList_SetPoint_2

Will Pearson edited this page Aug 12, 2016 · 2 revisions

NurbsCurvePointList.SetPoint Method (Int32, Double, Double, Double, Double)

Sets a specific control-point.

Namespace: Rhino.Geometry.Collections
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0

Syntax

C#

public bool SetPoint(
	int index,
	double x,
	double y,
	double z,
	double weight
)

VB

Public Function SetPoint ( 
	index As Integer,
	x As Double,
	y As Double,
	z As Double,
	weight As Double
) As Boolean

Parameters

 

index
Type: System.Int32
Index of control-point to set.
x
Type: System.Double
X coordinate of control-point.
y
Type: System.Double
Y coordinate of control-point.
z
Type: System.Double
Z coordinate of control-point.
weight
Type: System.Double
Weight of control-point.

Return Value

Type: Boolean
[Missing documentation for "M:Rhino.Geometry.Collections.NurbsCurvePointList.SetPoint(System.Int32,System.Double,System.Double,System.Double,System.Double)"]

Examples

VB

Partial Class Examples
  Public Shared Function AddNurbsCircle(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result
    ' The easy way to get a NURBS curve from a circle is with
    ' the following two lines of code.
    '
    ' Dim c As New Rhino.Geometry.Circle(20)
    ' Dim nc As Rhino.Geometry.NurbsCurve = c.ToNurbsCurve()
    '
    ' This sample demonstrates creating a NURBS curve from scratch.
    Const dimension As Integer = 3
    Const isRational As Boolean = True
    Const order As Integer = 3
    Const cv_count As Integer = 9
    Dim nc As New Rhino.Geometry.NurbsCurve(dimension, isRational, order, cv_count)
    nc.Points.SetPoint(0, 1.0, 0.0, 0.0, 1.0)
    nc.Points.SetPoint(1, 0.707107, 0.707107, 0.0, 0.707107)
    nc.Points.SetPoint(2, 0.0, 1.0, 0.0, 1.0)
    nc.Points.SetPoint(3, -0.707107, 0.707107, 0.0, 0.707107)
    nc.Points.SetPoint(4, -1.0, 0.0, 0.0, 1.0)
    nc.Points.SetPoint(5, -0.707107, -0.707107, 0.0, 0.707107)
    nc.Points.SetPoint(6, 0.0, -1.0, 0.0, 1.0)
    nc.Points.SetPoint(7, 0.707107, -0.707107, 0.0, 0.707107)
    nc.Points.SetPoint(8, 1.0, 0.0, 0.0, 1.0)
    nc.Knots(0) = 0.0
    nc.Knots(1) = 0.0
    nc.Knots(2) = 0.5 * Math.PI
    nc.Knots(3) = 0.5 * Math.PI
    nc.Knots(4) = Math.PI
    nc.Knots(5) = Math.PI
    nc.Knots(6) = 1.5 * Math.PI
    nc.Knots(7) = 1.5 * Math.PI
    nc.Knots(8) = 2.0 * Math.PI
    nc.Knots(9) = 2.0 * Math.PI
    If nc.IsValid Then
      doc.Objects.AddCurve(nc)
      doc.Views.Redraw()
      Return Rhino.Commands.Result.Success
    End If
    Return Rhino.Commands.Result.Failure
  End Function
End Class

C#

using System;

partial class Examples
{
  public static Rhino.Commands.Result AddNurbsCircle(Rhino.RhinoDoc doc)
  {
    // The easy way to get a NURBS curve from a circle is with
    // the following two lines of code.
    //
    // Rhino.Geometry.Circle c = new Rhino.Geometry.Circle(20);
    // Rhino.Geometry.NurbsCurve nc = c.ToNurbsCurve();
    //
    // This sample demonstrates creating a NURBS curve from scratch.
    const int dimension = 3;
    const bool isRational = true;
    const int order = 3;
    const int cv_count = 9;
    Rhino.Geometry.NurbsCurve nc = new Rhino.Geometry.NurbsCurve(dimension, isRational, order, cv_count);
    nc.Points.SetPoint(0, 1.0, 0.0, 0.0, 1.0);
    nc.Points.SetPoint(1, 0.707107, 0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(2, 0.0, 1.0, 0.0, 1.0);
    nc.Points.SetPoint(3, -0.707107, 0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(4, -1.0, 0.0, 0.0, 1.0);
    nc.Points.SetPoint(5, -0.707107, -0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(6, 0.0, -1.0, 0.0, 1.0);
    nc.Points.SetPoint(7, 0.707107, -0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(8, 1.0, 0.0, 0.0, 1.0);
    nc.Knots[0] = 0.0;
    nc.Knots[1] = 0.0;
    nc.Knots[2] = 0.5 * Math.PI;
    nc.Knots[3] = 0.5 * Math.PI;
    nc.Knots[4] = Math.PI;
    nc.Knots[5] = Math.PI;
    nc.Knots[6] = 1.5 * Math.PI;
    nc.Knots[7] = 1.5 * Math.PI;
    nc.Knots[8] = 2.0 * Math.PI;
    nc.Knots[9] = 2.0 * Math.PI;
    if (nc.IsValid)
    {
      doc.Objects.AddCurve(nc);
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
}

Python

using System;

partial class Examples
{
  public static Rhino.Commands.Result AddNurbsCircle(Rhino.RhinoDoc doc)
  {
    // The easy way to get a NURBS curve from a circle is with
    // the following two lines of code.
    //
    // Rhino.Geometry.Circle c = new Rhino.Geometry.Circle(20);
    // Rhino.Geometry.NurbsCurve nc = c.ToNurbsCurve();
    //
    // This sample demonstrates creating a NURBS curve from scratch.
    int dimension = 3;
    bool isRational = true;
    int order = 3;
    int cv_count = 9;
    Rhino.Geometry.NurbsCurve nc = new Rhino.Geometry.NurbsCurve(dimension, isRational, order, cv_count);
    nc.Points.SetPoint(0, 1.0, 0.0, 0.0, 1.0);
    nc.Points.SetPoint(1, 0.707107, 0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(2, 0.0, 1.0, 0.0, 1.0);
    nc.Points.SetPoint(3, -0.707107, 0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(4, -1.0, 0.0, 0.0, 1.0);
    nc.Points.SetPoint(5, -0.707107, -0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(6, 0.0, -1.0, 0.0, 1.0);
    nc.Points.SetPoint(7, 0.707107, -0.707107, 0.0, 0.707107);
    nc.Points.SetPoint(8, 1.0, 0.0, 0.0, 1.0);
    nc.Knots[0] = 0.0;
    nc.Knots[1] = 0.0;
    nc.Knots[2] = 0.5 * Math.PI;
    nc.Knots[3] = 0.5 * Math.PI;
    nc.Knots[4] = Math.PI;
    nc.Knots[5] = Math.PI;
    nc.Knots[6] = 1.5 * Math.PI;
    nc.Knots[7] = 1.5 * Math.PI;
    nc.Knots[8] = 2.0 * Math.PI;
    nc.Knots[9] = 2.0 * Math.PI;
    if (nc.IsValid)
    {
      doc.Objects.AddCurve(nc);
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
}

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

NurbsCurvePointList Class
SetPoint Overload
Rhino.Geometry.Collections Namespace

Clone this wiki locally