本文整理汇总了C#中Rhino.Geometry.Curve.ClosestPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.ClosestPoint方法的具体用法?C# Curve.ClosestPoint怎么用?C# Curve.ClosestPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Geometry.Curve
的用法示例。
在下文中一共展示了Curve.ClosestPoint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CurveCP
public void CurveCP(Brep x, Curve y, int V, int U)
{
int u = bitmap1.Size.Width;
int v = bitmap1.Size.Height;
Graphics g = Graphics.FromImage(bitmap1);
g.FillRectangle(new SolidBrush(Color.White), 0, 0, u, v);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.Black);
float step1 = u / U;
float step2 = v / V;
for (float i = 25; i < u - 25; i += step1)
{
for (float j = 25; j < v - 25; j += step2)
{
double Umin = x.Faces[0].Domain(0).Min;
double Umax = x.Faces[0].Domain(0).Max;
double Vmin = x.Faces[0].Domain(1).Min;
double Vmax = x.Faces[0].Domain(1).Max;
Point3d pos = x.Faces[0].PointAt(i / u * (Umax - Umin) + Umin, j / v * (Vmax - Vmin) + Vmin);
double t; float R;
if (y.ClosestPoint(pos, out t, 200))
{
double dis = y.PointAt(t).DistanceTo(pos);
dis /= 200;
R = (float)(1 / dis * 2);
if (R > 40) R = 40;
}
else { R = 20; }
g.FillEllipse(myBrush, i - R, v - j - R, R * 2, R * 2);
}
}
myBrush.Dispose();
g.Dispose();
}
示例2: NextintersectParamAndPoint
private static void NextintersectParamAndPoint(Curve[] overlapCurves, Point3d[] intersectPoints,
Curve curve, out double intersectParam, out Point3d intersectPoint)
{
var intersect_params_and_points = new Dictionary<double, Point3d>();
foreach (var point in intersectPoints)
{
double curve_param;
curve.ClosestPoint(point, out curve_param);
intersect_params_and_points[curve_param] = point;
}
foreach (var overlap_curve in overlapCurves)
{
intersect_params_and_points[overlap_curve.Domain.Min] = overlap_curve.PointAt(overlap_curve.Domain.Min);
intersect_params_and_points[overlap_curve.Domain.Max] = overlap_curve.PointAt(overlap_curve.Domain.Max);
}
var min_t = intersect_params_and_points.Keys.Min();
intersectParam = min_t;
intersectPoint = intersect_params_and_points[intersectParam];
}
示例3: PerformSweepRebuild
public Brep[] PerformSweepRebuild(Curve rail, IEnumerable<Curve> crossSections, int rebuildCount)
{
List<double> rail_params = new List<double>();
foreach (Curve c in crossSections)
{
Point3d point_at_start = c.PointAtStart;
double t;
rail.ClosestPoint(point_at_start, out t);
rail_params.Add(t);
}
return PerformSweepRebuild(rail, crossSections, rail_params, rebuildCount);
}
示例4: PerformSweep
/// <example>
/// <code source='examples\vbnet\ex_sweep1.vb' lang='vbnet'/>
/// <code source='examples\cs\ex_sweep1.cs' lang='cs'/>
/// <code source='examples\py\ex_sweep1.py' lang='py'/>
/// </example>
public Brep[] PerformSweep(Curve rail, IEnumerable<Curve> crossSections)
{
List<double> rail_params = new List<double>();
Interval domain = rail.Domain;
foreach (Curve c in crossSections)
{
Point3d point_at_start = c.PointAtStart;
double t;
rail.ClosestPoint(point_at_start, out t);
if (t == domain.Max)
t = domain.Max - RhinoMath.SqrtEpsilon;
rail_params.Add(t);
}
if (rail_params.Count == 1 && Math.Abs(rail_params[0]-rail.Domain.Max)<=RhinoMath.SqrtEpsilon )
{
// 27 May 2011 - S. Baer
// I had to dig through source for quite a while to figure out what is going on, but
// if there is only one cross section and we are NOT using start/end points, then a
// rail_param at rail.Domain.Max is appended which completely messes things up when the
// only shape curve is already at the max domain of the rail.
rail.Reverse();
rail_params[0] = rail.Domain.Min;
}
return PerformSweep(rail, crossSections, rail_params);
}
示例5: PerformSweepRefit
public Brep[] PerformSweepRefit(Curve rail1, Curve rail2, IEnumerable<Curve> crossSections, double refitTolerance)
{
List<double> rail_params1 = new List<double>();
List<double> rail_params2 = new List<double>();
foreach (Curve c in crossSections)
{
Point3d point_at_start = c.PointAtStart;
double t;
rail1.ClosestPoint(point_at_start, out t);
rail_params1.Add(t);
rail2.ClosestPoint(point_at_start, out t);
rail_params2.Add(t);
}
return PerformSweepRefit(rail1, rail2, crossSections, rail_params1, rail_params2, refitTolerance);
}
示例6: PerformSweep
public Brep[] PerformSweep(Curve rail1, Curve rail2, IEnumerable<Curve> crossSections)
{
List<double> rail_params1 = new List<double>();
List<double> rail_params2 = new List<double>();
Interval domain1 = rail1.Domain;
Interval domain2 = rail2.Domain;
foreach (Curve c in crossSections)
{
Point3d point_at_start = c.PointAtStart;
double t;
rail1.ClosestPoint(point_at_start, out t);
if (t == domain1.Max)
t = domain1.Max - RhinoMath.SqrtEpsilon;
rail_params1.Add(t);
rail2.ClosestPoint(point_at_start, out t);
if (t == domain2.Max)
t = domain2.Max - RhinoMath.SqrtEpsilon;
rail_params2.Add(t);
}
// NOTE: See if we need to do anything special in a rail_params1.Count==1 case
// like we do in the Sweep1 counterpart function
return PerformSweep(rail1, rail2, crossSections, rail_params1, rail_params2);
}
示例7: RunScript
private void RunScript(Brep x, Curve y, int V, int U, ref object A)
{
Graphics g = Graphics.FromImage(bitmap1);
g.FillRectangle(new SolidBrush(Color.White), 0, 0, u, v);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.Black);
float step1 = u / U;
float step2 = v / V;
for (float i = 25; i < u - 25; i += step1)
{
for (float j = 25; j < v - 25; j += step2)
{
double Umin = x.Faces[0].Domain(0).Min;
double Umax = x.Faces[0].Domain(0).Max;
double Vmin = x.Faces[0].Domain(1).Min;
double Vmax = x.Faces[0].Domain(1).Max;
Point3d pos = x.Faces[0].PointAt(i / u * (Umax - Umin) + Umin, j / v * (Vmax - Vmin) + Vmin);
double t; float R;
if (y.ClosestPoint(pos, out t, 200))
{
double dis = y.PointAt(t).DistanceTo(pos);
dis /= 200;
R = (float)(1 / dis * 2);
// Print(R.ToString());
if (R > 40) R = 40;
;
}
else { R = 20; }
g.FillEllipse(myBrush, i - R, v - j - R, R * 2, R * 2);
}
}
myBrush.Dispose();
str = @"C:\maps\temp1.jpg";
bitmap1.Save(str);
Print(str);
///////////////////////////////////////////////////////////////////////////////////////////////////////
Mesh[] meshes = Mesh.CreateFromBrep(x, MeshingParameters.Smooth);
Mesh M = new Mesh();
foreach (Mesh partialMesh in meshes)
{
M.Append(partialMesh);
}
m_shapes.Add(M);
Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial();
mat.SetTransparencyTexture(str, true);
mat.BackTransparency = 0;
m_materials.Clear();
m_materials.Add(mat);
}
示例8: CalcDeformedTangent
private Vector3d CalcDeformedTangent(Curve c, Point3d pt)
{
double t;
if (!c.ClosestPoint(pt, out t))
throw new Exception();
else
return c.TangentAt(t);
}
示例9: computeBiasHeight
private double computeBiasHeight(Point3d P, bool biasApicalRegions, Curve boundaryCurve)
{
double t;
boundaryCurve.ClosestPoint(P, out t);
double minDist = Utils.Distance(P, boundaryCurve.PointAt(t));
if (biasApicalRegions)
foreach (Circle apical in iApicals)
{
double dist = Utils.Distance(P, apical.Center) - (apical.Radius + 0.1);
if (dist < 0.0) dist = 0.0;
if (dist < minDist)
minDist = dist;
}
return iInitialCurvingBias * (1.0 - Math.Pow(0.9, minDist * 15.0));
}