本文整理汇总了C#中Rhino.Geometry.Curve.TangentAt方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.TangentAt方法的具体用法?C# Curve.TangentAt怎么用?C# Curve.TangentAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Geometry.Curve
的用法示例。
在下文中一共展示了Curve.TangentAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DivByAngle
/**
* divideCrvsByDeltaTan : Curve[] * double -> LinkedList<Plane>
* REQUIRES: theta > 0
* ENSURES: divideCrvsByDeltaTan(crvs, theta) returns a linked list of planes
* along the curves s.t. there is a plane at every point along
* the curve where the change in the tangent vector between
* two points is greater than theta.
**/
private IEnumerable<Point3d> DivByAngle(Curve crv, double angle)
{
//initialize parameters
double theta = angle;
Interval dom = crv.Domain;
double stepSize = Math.Abs(dom.Length) * Constants.AbsoluteTolerance * Constants.AbsoluteTolerance;
//initialize list
List<Point3d> pts = new List<Point3d>();
Continuity c = Continuity.C1_continuous;
//initialize data
double rover = dom.Min; //steps along the curve by stepSize
//Add plane at start point of curve to list
Point3d pt = crv.PointAt(rover);
pts.Add(pt);
//Increment
Vector3d prevTan = crv.TangentAt(rover);
double oldRover = rover; //stores the previous rover for comparison
rover += stepSize;
while (rover < dom.Max)
{
Vector3d currTan = crv.TangentAt(rover);
//If there is a discontinuity between the oldRover and rover
//then place a point at the discontinuity and update prevTan.
double discontinuity;
bool isDisc = crv.GetNextDiscontinuity(c, oldRover, rover,
out discontinuity);
if (isDisc)
{
pt = crv.PointAt(discontinuity);
pts.Add(pt);
prevTan = crv.TangentAt(discontinuity);
}
//If the change in tangent vector is greater than theta,
//then drop a target at the rover and update prevTan.
double delta = RhinoMath.ToDegrees(Math.Abs(Vector3d.VectorAngle(prevTan, currTan)));
if (delta > theta)
{
pt = crv.PointAt(rover);
pts.Add(pt);
prevTan = currTan;
}
//Increment
oldRover = rover;
rover += stepSize;
}
//Add target at end point of curve
pt = crv.PointAt(dom.Max);
pts.Add(pt);
return pts;
}
示例2: horizFrame
public Plane horizFrame(Curve C, double t)
{
//Create a plane aligned with the world z-axis
Vector3d Tangent = C.TangentAt(t);
Vector3d Z = Vector3d.ZAxis;
Z.Reverse();
Vector3d Perp = Vector3d.CrossProduct(Z, Tangent);
Plane frame = new Plane(C.PointAt(t), Tangent, Perp);
return frame;
}
示例3: Directions
public override BroadRay Directions(int index, int thread, ref Random random, ref Curve Curves, ref double[] DomainPower, ref double Delay, ref Phase_Regime ph, ref int S_ID)
{
double pos = random.NextDouble();
int i;
Interval t = Curves.Domain;
double x = random.NextDouble() * (t[1] - t[0]) + t[0];
Point3d P = Curves.PointAt(x);
Vector3d f = Curves.TangentAt(x);
Vector fore = new Hare.Geometry.Vector(f.X, f.Y, f.Z);
double Theta = random.NextDouble() * 2 * System.Math.PI;
double Phi = random.NextDouble() * 2 * System.Math.PI;
Vector Direction = new Hare.Geometry.Vector(Math.Sin(Theta) * Math.Cos(Phi), Math.Sin(Theta) * Math.Sin(Phi), Math.Cos(Theta));
double cosphi = Hare.Geometry.Hare_math.Dot(Direction, fore);
double sinphi = Math.Sqrt(1 - cosphi * cosphi);
double tanphi = sinphi/cosphi;
double F_r = sinphi * sinphi * Math.Pow((tanphi * tanphi + 1) / (tanphi * tanphi + (1 + tanphi * Math.Tan(delta))), 1.5);
double[] power = new double[8];
for (int oct = 0; oct < 8; oct++) power[oct] = DomainPower[oct] * reciprocal_velocity * dLinf * F_r;
double[] phase = new double[8];
if (ph == Phase_Regime.Random) for (int o = 0; o < 8; o++) phase[o] = random.Next() * 2 * Math.PI;
else for (int o = 0; o < 8; o++) phase[o] = 0 - Delay * Utilities.Numerics.angularFrequency[o];
return new BroadRay(Utilities.PachTools.RPttoHPt(P), Direction, random.Next(), thread, DomainPower, phase, Delay, S_ID);
}
示例4: DirPower
public override double[] DirPower(int threadid, int random, Vector Direction, double position, ref Curve Curves, ref double[] DomainPower)
{
X_Event X = new X_Event();
double[] RayPower = new double[8];
Interval t = Curves.Domain;
Point3d P = Curves.PointAt((position/t.Length) + t.Min);
Vector3d f = Curves.TangentAt(position);
Vector fore = new Hare.Geometry.Vector(f.X, f.Y, f.Z);
double cosphi = Hare.Geometry.Hare_math.Dot(Direction, fore);
double sinphi = Math.Sqrt(1 - cosphi * cosphi);
double tanphi = sinphi / cosphi;
double F_r = sinphi * sinphi * Math.Pow((tanphi * tanphi + 1) / (tanphi * tanphi + (1 + tanphi * Math.Tan(delta))), 1.5);
for (int oct = 0; oct < 8; oct++)
{
if (DomainPower[oct] == 0)
{
RayPower[oct] = 0;
}
else
{
RayPower[oct] = DomainPower[oct] * reciprocal_velocity * dLinf * F_r;
}
}
return RayPower;
}
示例5: CalcDeformedTangent
private Vector3d CalcDeformedTangent(Curve c, Point3d pt)
{
double t;
if (!c.ClosestPoint(pt, out t))
throw new Exception();
else
return c.TangentAt(t);
}