本文整理汇总了C#中System.Windows.Media.Media3D.Point3D.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# Point3D.Offset方法的具体用法?C# Point3D.Offset怎么用?C# Point3D.Offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.Point3D
的用法示例。
在下文中一共展示了Point3D.Offset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformOperation
//.........这里部分代码省略.........
syntaxString = " vectorResult = point1 - point2;";
resultType = "Vector3D";
operationString = "Subtracting a Point3D from a Point3D";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb6":
{
// Subtracts a Point3D from a Point3D using the static Subtract method.
// Returns a Vector3D.
Point3D point1 = new Point3D(10, 5, 1);
Point3D point2 = new Point3D(15, 40, 60);
Vector3D vectorResult = new Vector3D();
vectorResult = Point3D.Subtract(point1, point2);
// vectorResult is equal to (-5, -35, -59)
// Displaying Results
syntaxString = "vectorResult = Point3D.Subtract(point1, point2);";
resultType = "Vector3D";
operationString = "Subtracting a Point3D from a Point3D";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb7":
{
// Offsets the X, Y and Z values of a Point3D.
Point3D point1 = new Point3D(10, 5, 1);
point1.Offset(20, 30, 40);
// point1 is equal to (30, 35, 41)
// Note: This operation is equivalent to adding a point
// to vector with the corresponding X,Y, Z values.
// Displaying Results
syntaxString = "point1.Offset(20, 30, 40);";
resultType = "Point3D";
operationString = "Offsetting a Point3D";
ShowResults(point1.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb8":
{
// Multiplies a Point3D by a Matrix.
// Returns a Point3D.
Point3D point1 = new Point3D(10, 5, 1);
Point3D pointResult = new Point3D();
Matrix3D matrix1 = new Matrix3D(10, 10, 10, 0, 20, 20, 20, 0, 30, 30, 30, 0, 5, 10, 15, 1);
pointResult = point1 * matrix1;
// pointResult is equal to (235, 240, 245)
// Displaying Results
resultType = "Point3D";
syntaxString = "pointResult = point1 * matrix1;";
operationString = "Multiplying a Point3D by a Matrix3D";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
示例2: moveToAngles
private void moveToAngles(double alpha, double beta, double gamma) {
RotateTransform3D bodyCoxaTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), alpha));
bodyCoxaTransform.CenterX = 0;
bodyCoxaTransform.CenterY = 0;
bodyCoxaTransform.CenterZ = 0;
Model.Transform = bodyCoxaTransform;
RotateTransform3D coxaFemurTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), beta));
coxaFemurTransform.CenterX = bodyCoxaLen;
coxaFemurTransform.CenterY = 0;
coxaFemurTransform.CenterZ = 0;
femurTibiaLink.Model.Transform = coxaFemurTransform;
femurTibiaJoint.Model.Transform = coxaFemurTransform;
foot.Model.Transform = coxaFemurTransform;
var group3Dtransformation = new Transform3DGroup();
group3Dtransformation.Children.Add(femurTibiaLink.Model.Transform);
Point3D origin = group3Dtransformation.Transform(new Point3D(bodyCoxaLen, 0, femurLen));
RotateTransform3D femurTibiaTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), gamma));
femurTibiaTransform.CenterX = origin.X;
femurTibiaTransform.CenterY = origin.Y;
femurTibiaTransform.CenterZ = origin.Z;
group3Dtransformation.Children.Add(femurTibiaTransform);
tibiaFootLink.Model.Transform = group3Dtransformation;
foot.Model.Transform = group3Dtransformation;
var p = new Point3D(bodyCoxaJoint.Point2.X, bodyCoxaJoint.Point2.Y, bodyCoxaJoint.Point2.Z);
p.Offset(0, 0, 1.5 * jointDiameter);
coxaAngleLabel.Position = p;
coxaAngleLabel.Text = String.Format("{0:N1}°", alpha);
var q = new Point3D(coxaFemurTransform.CenterX, coxaFemurTransform.CenterY, coxaFemurTransform.CenterZ);
q.Offset(0,0, -2 * jointDiameter);
femurAngleLabel.Transform = bodyCoxaTransform;
femurAngleLabel.Position = q;
femurAngleLabel.Text = String.Format("{0:N1}°", beta);
var r = new Point3D(femurTibiaTransform.CenterX, femurTibiaTransform.CenterY, femurTibiaTransform.CenterZ);
r.Offset(0, 0, 1.5 * jointDiameter);
tibiaAngleLabel.Position = r;
tibiaAngleLabel.Transform = bodyCoxaTransform;
tibiaAngleLabel.Text = String.Format("{0:N1}°", gamma);
// coxaFemurConstraint.Transform = bodyCoxaTransform;
}
示例3: GetPointAdjustedBy
private Point3D GetPointAdjustedBy(Point3D point, Point3D adjustBy)
{
var newPoint = new Point3D { X = point.X, Y = point.Y, Z = point.Z };
newPoint.Offset(adjustBy.X, adjustBy.Y, adjustBy.Z);
return newPoint;
}
示例4: PopulateControlLists
/// <summary>
/// Helper function used by <see cref="CreateControlPoints" /> to populate the data
/// stuctures which hold control point data.
/// </summary>
private void PopulateControlLists()
{
Vector3D previousD = new Vector3D();
for (int i = 0; i < this.caList.Count - 1; i++)
{
Point3D ca1 = this.caList[i];
Point3D o1 = this.oList[i];
Point3D ca2 = this.caList[i + 1];
Point3D p = new Point3D((ca1.X + ca2.X) / 2, (ca1.Y + ca2.Y) / 2,
(ca1.Z + ca2.Z) / 2);
Vector3D a = ca2 - ca1;
Vector3D b = o1 - ca1;
Vector3D c = Vector3D.CrossProduct(a, b);
Vector3D d = Vector3D.CrossProduct(c, a);
c.Normalize();
d.Normalize();
if (this.isHelixList[i] && this.isHelixList[i + 1])
p.Offset(1.5 * c.X, 1.5 * c.Y, 1.5 * c.Z);
if (i > 0 && Vector3D.AngleBetween(d, previousD) > 90) d.Negate();
previousD = d;
this.pList.Add(p);
this.dList.Add(p + d);
}
}