本文整理汇总了C#中Point3d.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.Transform方法的具体用法?C# Point3d.Transform怎么用?C# Point3d.Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3d
的用法示例。
在下文中一共展示了Point3d.Transform方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ssget_point
private List<ObjRef> ssget_point(RhinoDoc doc, RhinoView view, Point3d point)
{
var world_to_screen = view.ActiveViewport.GetTransform(CoordinateSystem.World, CoordinateSystem.Screen);
point.Transform(world_to_screen);
var pick_context = new PickContext();
pick_context.View = view;
pick_context.PickStyle = PickStyle.PointPick;
pick_context.PickGroupsEnabled = true;
var xform = view.ActiveViewport.GetPickTransform(Convert.ToInt32(point.X), Convert.ToInt32(point.Y));
pick_context.SetPickTransform(xform);
double depth, distance;
foreach (var rhino_object in doc.Objects)
{
//rhino_object.OnPicked(pick_context, )
}
if (pick_context.PickFrustumTest(point, out depth, out distance))
pick_context.UpdateClippingPlanes();
return null;
}
示例2: Sort
public void Sort()
{
//sort the refer points in clockwise order
Plane p1 = new Plane(this.pos, this.N);
Plane p2 = new Plane(new Point3d(0, 0, 0), new Vector3d(0, 0, 1));
for (int i = 0; i < this.refpoints.Count; i++)
{
Point3d P = new Point3d(this.refpoints[i].pos);
P.Transform(Transform.PlaneToPlane(p1, p2));
Vector3d v = new Vector3d(P.X, P.Y, 0);
double t = 0;
if (P.Y >= 0) { t = Vector3d.VectorAngle(new Vector3d(1, 0, 0), v); }
else { t = Math.PI * 2 - Vector3d.VectorAngle(new Vector3d(1, 0, 0), v); }
this.refpoints[i].order = t;
}
this.refpoints.Sort(CompareDinosByLength);
}
示例3: Sort
public void Sort(List<Vertice2> vs)
{
//sort the refer points in clockwise order
List<IndexPair> refpoints = new List<IndexPair>();
if (this.refer.Count < 3) return;
Plane p1 = new Plane(this.pos, this.N);
Plane p2 = new Plane(new Point3d(0, 0, 0), new Vector3d(0, 0, 1));
for (int i = 0; i < this.refer.Count; i++)
{
Point3d P = new Point3d(vs[this.refer[i]].pos);
P.Transform(Transform.PlaneToPlane(p1, p2));
Vector3d v = new Vector3d(P.X, P.Y, 0);
double t = 0;
if (P.Y >= 0) { t = Vector3d.VectorAngle(new Vector3d(1, 0, 0), v); }
else { t = Math.PI * 2 - Vector3d.VectorAngle(new Vector3d(1, 0, 0), v); }
refpoints.Add(new IndexPair(this.refer[i], (int)(t * 1000000)));
}
refpoints.Sort(CompareDinosByLength);
this.refer.Clear();
for (int i = 0; i < refpoints.Count; i++)
{
this.refer.Add(refpoints[i].I);
}
}
示例4: SolveInstance
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
// Implementation in C# by Mikael Nillsson
// http://guideving.blogspot.nl/2010/08/sun-position-in-c.html
// Adaptation to Grasshopper By Arend van Waart <[email protected]>
// @see http://stackoverflow.com/questions/8708048/position-of-the-sun-given-time-of-day-latitude-and-longitude
Vector3d North = Vector3d.Unset;
Vector3d Up = Vector3d.Unset;
DateTime Time = DateTime.Now;
int GMT = 0;
double Latitude = 0;
double Longitude = 0;
DA.GetData("GMT", ref GMT);
DA.GetData("Time", ref Time);
DA.GetData("Up", ref Up);
DA.GetData("North", ref North);
DA.GetData("Latitude", ref Latitude);
DA.GetData("Longitude", ref Longitude);
North.Unitize();
Up.Unitize();
//DateTime time = Time;
// assume the time is in UTC.
DateTime time = new DateTime(Time.Year, Time.Month, Time.Day, Time.Hour, Time.Minute, Time.Second, DateTimeKind.Utc);
time = time.AddHours(-GMT);
double altitude, azimuth;
this.CalculateSunPosition(time, Latitude, Longitude, out azimuth, out altitude);
DA.SetData("azimuth", azimuth);
DA.SetData("altitude", altitude);
// plane: x = north; y = up
Point3d p0 = new Point3d(0, 0, 0);
Point3d p1 = new Point3d(1, 0, 0);
p1.Transform(Transform.Translation(North));
p1.Transform(Transform.Rotation(azimuth, Up, p0));
Plane azPlane = new Plane(p0, new Vector3d(p1), Up);
p1.Transform(Transform.Rotation(altitude, azPlane.ZAxis, p0));
Vector3d dir = new Vector3d(p1);
dir.Unitize();
DA.SetData("direction", dir);
}
示例5: Image
/// <summary>
/// used by the image source method to mirror sources over a face.
/// </summary>
/// <param name="PassedPoint">the point to mirror</param>
/// <param name="q">the index of the surface to use</param>
/// <returns>the mirrored point</returns>
public Point3d Image(Point3d PassedPoint, int q, ref bool Success)
{
if (PlaneBoolean[q])
{
PassedPoint.Transform(Mirror[q]);
Success = true;
return new Point3d(PassedPoint.X, PassedPoint.Y, PassedPoint.Z);
}
else
{
Success = false;
return default(Point3d);
}
}
示例6: GetBorderWalls
private Brep[] GetBorderWalls(Curve borderCrv, IEnumerable<Point3d> pts, IEnumerable<Vector3d> nrmls, double dist)
{
List<Point3d> ptsOut = new List<Point3d>();
List<Point3d> ptsIn = new List<Point3d>();
IEnumerator ptEnum = pts.GetEnumerator();
IEnumerator nrmlEnum = nrmls.GetEnumerator();
while ((ptEnum.MoveNext()) && (nrmlEnum.MoveNext()))
{
Point3d pt = (Point3d)ptEnum.Current;
Vector3d nrml = (Vector3d)nrmlEnum.Current;
Transform mvOut = Transform.Translation(nrml * dist);
Transform mvIn = Transform.Translation(nrml * -dist);
Point3d ptOut = new Point3d(pt);
Point3d ptIn = new Point3d(pt);
ptOut.Transform(mvOut);
ptIn.Transform(mvIn);
ptsOut.Add(ptOut);
ptsIn.Add(ptIn);
}
Curve crvOut;
Curve crvIn;
if (borderCrv.IsPolyline())
{
crvOut = new PolylineCurve(ptsOut);
crvIn = new PolylineCurve(ptsIn);
}
else
{
crvOut = Curve.CreateInterpolatedCurve(ptsOut, 3);
crvIn = Curve.CreateInterpolatedCurve(ptsIn, 3);
}
List<Curve> crvs = new List<Curve>();
crvs.Add(crvOut);
crvs.Add(crvIn);
Brep[] lofts = Brep.CreateFromLoft(crvs, Point3d.Unset, Point3d.Unset, LoftType.Normal, false);
Interval interval = new Interval(0, 1);
double u, v;
u = v = 0.05;
BrepFace loftFace = lofts[0].Faces[0];
loftFace.SetDomain(0, interval);
loftFace.SetDomain(1, interval);
while (u < 1 && v < 1)
{
if (loftFace.IsPointOnFace(u, v).Equals(PointFaceRelation.Interior))
{
break;
}
u += .05;
v += .05;
}
Point3d loftPt = loftFace.PointAt(u, v);
Vector3d loftNrml = loftFace.NormalAt(u, v);
Point3d loftPtOut = loftPt;
Point3d loftPtIn = loftPt;
loftPtOut.Transform(Transform.Translation(loftNrml));
loftNrml.Reverse();
loftPtIn.Transform(Transform.Translation(loftNrml));
Point3d envPtOut = environment.ClosestPoint(loftPtOut);
Point3d envPtIn = environment.ClosestPoint(loftPtIn);
if (loftPtOut.DistanceTo(envPtOut) < loftPtIn.DistanceTo(envPtIn))
{
foreach (Brep brep in lofts)
{
brep.Flip();
}
}
return lofts;
}
示例7: AddPoint
/// <summary> Add a point </summary>
/// <param name="doc"></param>
/// <param name="point"></param>
/// <returns> ?? </returns>
public Rhino.Geometry.Point3d AddPoint(RhinoDoc doc, System.Drawing.Point point)
{
Rhino.Geometry.Point3d start1 = new Point3d((point.X) - 400, (-point.Y ) + 400, zDepth + .5);
Rhino.Geometry.Transform plnXForm = Rhino.Geometry.Transform.PlaneToPlane(Rhino.Geometry.Plane.WorldXY, plane1);
start1.Transform(plnXForm);
mRhinoDoc.Objects.AddPoint(start1);
mRhinoDoc.Views.Redraw();
return start1;
}
示例8: SolveKdTree2
public static List<Polyline> SolveKdTree2(List<Point3d> points, Polyline pl, Plane p)
{
//Plane p = new Plane(pl[0], pl[1], pl[2]);
Transform xf = Transform.PlaneToPlane(p, Plane.WorldXY);
pl.Transform(xf);
for (int i = 0; i < points.Count; i++)
{
Point3d pt = new Point3d(points[i]);
pt.Transform(Transform.PlanarProjection(p));
pt.Transform(xf);
points[i] = pt;
}
List<Polyline> pls = KdTree.SolveKdTree2(points, pl);
xf = Transform.PlaneToPlane(Plane.WorldXY, p);
for (int i = 0; i < pls.Count; i++)
{
pls[i].Transform(xf);
}
return pls;
}