本文整理匯總了C#中System.Windows.Media.Media3D.Point3D類的典型用法代碼示例。如果您正苦於以下問題:C# Point3D類的具體用法?C# Point3D怎麽用?C# Point3D使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Point3D類屬於System.Windows.Media.Media3D命名空間,在下文中一共展示了Point3D類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Create
public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh)
{
try
{
Uri inpuri = new Uri(@pictureName, UriKind.Relative);
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = inpuri;
bi.EndInit();
ImageBrush imagebrush = new ImageBrush(bi);
imagebrush.Opacity = 100;
imagebrush.Freeze();
Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) };
Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) };
SolidColorBrush modelbrush = new SolidColorBrush(modelColor);
Model3DGroup cube = new Model3DGroup();
Point3D uppercircle = startPos;
modelbrush.Freeze();
uppercircle.Y = startPos.Y + maxHigh;
cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0)));
cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0)));
cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0));
return cube;
}
catch (Exception ex)
{
throw ex;
}
}
示例2: SetPoint
internal static void SetPoint(this User user, JointID joint, Point3D newPoint)
{
switch (joint)
{
case JointID.Head:
user.Head = newPoint;
break;
case JointID.AnkleLeft:
user.AnkleLeft = newPoint;
break;
case JointID.ElbowLeft:
user.ElbowLeft = newPoint;
break;
case JointID.FootLeft:
user.FootLeft = newPoint;
break;
case JointID.HandLeft:
user.HandLeft = newPoint;
break;
case JointID.KneeLeft:
user.KneeLeft = newPoint;
break;
case JointID.ShoulderLeft:
user.ShoulderLeft = newPoint;
break;
case JointID.HipLeft:
user.HipLeft = newPoint;
break;
case JointID.ShoulderCenter:
user.ShoulderCenter = newPoint;
break;
case JointID.AnkleRight:
user.AnkleRight = newPoint;
break;
case JointID.ElbowRight:
user.ElbowRight = newPoint;
break;
case JointID.FootRight:
user.FootRight = newPoint;
break;
case JointID.HandRight:
user.HandRight = newPoint;
break;
case JointID.KneeRight:
user.KneeRight = newPoint;
break;
case JointID.HipRight:
user.HipRight = newPoint;
break;
case JointID.ShoulderRight:
user.ShoulderRight = newPoint;
break;
case JointID.Spine:
user.Spine = newPoint;
break;
case JointID.HipCenter:
user.HipCenter = newPoint;
break;
}
}
示例3: CreateMesh
protected override Geometry3D CreateMesh()
{
_radius = Radius;
_position = Position;
MeshGeometry3D mesh = new MeshGeometry3D();
Point3D prevPoint = PointForAngle(0);
Vector3D normal = new Vector3D(0, 0, 1);
const int div = 180;
for (int i = 1; i <= div; ++i)
{
double angle = 2 * Math.PI / div * i;
Point3D newPoint = PointForAngle(angle);
mesh.Positions.Add(prevPoint);
mesh.Positions.Add(_position);
mesh.Positions.Add(newPoint);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
prevPoint = newPoint;
}
mesh.Freeze();
return mesh;
}
示例4: BuildStarSystemCollection
public List<StarSystem> BuildStarSystemCollection(Point3D midPoint, double range)
{
List<StarSystem> returnList = new List<StarSystem>();
double minX = midPoint.X - range;
double minY = midPoint.Y - range;
double minZ = midPoint.Z - range;
double maxX = midPoint.X + range;
double maxY = midPoint.Y + range;
double maxZ = midPoint.Z + range;
foreach (var systemlist in milkyWay
.Where(system => system.Location.X >= minX && system.Location.X <= maxX &&
system.Location.Y >= minY && system.Location.Y <= maxY &&
system.Location.Z >= minZ && system.Location.Z <= maxZ))
{
if (calculateDistance(midPoint, new Point3D(systemlist.Location.X, systemlist.Location.Y, systemlist.Location.Z)) <= range)
{
returnList.Add(systemlist);
}
}
centerPoint = midPoint;
return returnList;
}
示例5: Star
public Star()
{
starColor = foregroundBrush;
starGFX = new Ellipse();
starSEL = new Ellipse();
starCanvas = new Canvas();
starLabel = new Label();
starSEL.Visibility = Visibility.Hidden;
starGFX.Fill = foregroundBrush;
starLabel.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#Euro Caps");
starLabel.Foreground = fontBrush;
starCanvas.Children.Add(starLabel);
starCanvas.Children.Add(starGFX);
starCanvas.Children.Add(starSEL);
movePoint = new Point3D(0,0,0);
rotaPoint = new Point3D(0,0,0);
starCanvas.MouseLeftButtonDown += SetSelection;
starCanvas.MouseRightButtonDown +=TargetSelection;
starCanvas.MouseEnter += ShowInfoSelection;
starCanvas.MouseLeave += HideInfoSelection;
}
示例6: KinectV1Settings
public KinectV1Settings(string uniqueID, int kinectNumber)
{
uniqueKinectID = uniqueID;
kinectID = kinectNumber;
//Set everything to the default value
colorImageMode = ColorImageFormat.RgbResolution640x480Fps30;
lineFrequency = PowerLineFrequency.SixtyHertz;
autoWhiteBalance = true;
autoExposure = true;
backlightMode = BacklightCompensationMode.AverageBrightness;
depthImageMode = DepthImageFormat.Resolution320x240Fps30;
isNearMode = false;
irON = true;
scaleDepthToReliableRange = false;
colorizeDepth = false;
mergeSkeletons = false;
kinectPosition = new Point3D(0, 0, 0);
kinectYaw = 0.0;
sendAcceleration = false;
sendAudioAngle = false;
audioTrackMode = AudioTrackingMode.Loudest;
sendColorImage = false;
sendDepthImage = false;
//Setup the options for the raw skeleton, irrespective of use
rawSkeletonSettings = new SkeletonSettings();
}
示例7: GetPoints
public static Point3D[] GetPoints(int count, Point3D[] controlPoints)
{
#region asserts
#if DEBUG
if (controlPoints.Length < 2)
{
throw new ArgumentException("There must be at least two points passed in: " + controlPoints.Length.ToString());
}
#endif
#endregion
double countD = count - 1;
Point3D[] retVal = new Point3D[count];
retVal[0] = controlPoints[0];
retVal[count - 1] = controlPoints[controlPoints.Length - 1];
for (int cntr = 1; cntr < count - 1; cntr++)
{
retVal[cntr] = GetPoint(cntr / countD, controlPoints);
}
return retVal;
}
示例8: WWLineSegment
public WWLineSegment(Point3D startPos, Vector3D dirNormalized, double length, double intensity)
{
StartPos = startPos;
Direction = dirNormalized;
Length = length;
Intensity = intensity;
}
示例9: ExplodingMesh
public ExplodingMesh(MeshGeometry3D inputMesh, Point3D hitpos)
{
var mesh = MeshGeometryHelper.NoSharedVertices(inputMesh);
double cx, cy, cz;
cx = cy = cz = 0;
for (int i = 0; i < mesh.Positions.Count; i++)
{
cx += mesh.Positions[i].X;
cy += mesh.Positions[i].Y;
cz += mesh.Positions[i].Z;
}
int n = mesh.Positions.Count;
var center = new Point3D(cx / n, cy / n, cz / n);
integrator = new VerletIntegrator();
integrator.Resize(mesh.Positions.Count);
var r = new Random();
for (int i = 0; i < mesh.Positions.Count; i++)
{
var delta = mesh.Positions[i] - center;
delta.Normalize();
integrator.Positions[i] = mesh.Positions[i] + delta * (1 + r.NextDouble() * 2);
integrator.Positions0[i] = mesh.Positions[i];
integrator.Accelerations[i] = new Vector3D(0, 0, -1000);
integrator.InverseMass[i] = 0.01;
}
integrator.CreateConstraintsByMesh(mesh, 0.7);
integrator.AddFloor(0.3);
this.Mesh = mesh;
watch.Start();
}
示例10: JointStatus
public JointStatus()
{
position = new Point3D(0, 0, 0);
speed = new Point3D(0, 0, 0);
abs_speed = 0;
angle = 0;
}
示例11: AddPlaneToMesh
public static MeshGeometry3D AddPlaneToMesh(MeshGeometry3D mesh, Vector3D normal, Point3D upperLeft, Point3D lowerLeft, Point3D lowerRight, Point3D upperRight)
{
int offset = mesh.Positions.Count;
mesh.Positions.Add(upperLeft);
mesh.Positions.Add(lowerLeft);
mesh.Positions.Add(lowerRight);
mesh.Positions.Add(upperRight);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.TextureCoordinates.Add(new Point(0, 0));
mesh.TextureCoordinates.Add(new Point(0, 1));
mesh.TextureCoordinates.Add(new Point(1, 1));
mesh.TextureCoordinates.Add(new Point(1, 0));
mesh.TriangleIndices.Add(offset + 0);
mesh.TriangleIndices.Add(offset + 1);
mesh.TriangleIndices.Add(offset + 2);
mesh.TriangleIndices.Add(offset + 0);
mesh.TriangleIndices.Add(offset + 2);
mesh.TriangleIndices.Add(offset + 3);
return mesh;
}
示例12: drawTor
public static void drawTor(Point3D center, double R, double r, int N, int n, Color color, Viewport3D mainViewport)
{
if (n < 2 || N < 2)
{
return;
}
Model3DGroup tor = new Model3DGroup();
Point3D[,] points = new Point3D[N, n];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < n; j++)
{
points[i, j] = getPositionTor(R, r, i * 360 / (N - 1), j * 360 / (n - 1));
points[i, j] += (Vector3D)center;
}
}
Point3D[] p = new Point3D[4];
for (int i = 0; i < N - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
p[0] = points[i, j];
p[1] = points[i + 1, j];
p[2] = points[i + 1, j + 1];
p[3] = points[i, j + 1];
drawTriangle(p[0], p[1], p[2], color, mainViewport);
drawTriangle(p[2], p[3], p[0], color, mainViewport);
}
}
}
示例13: FlipTile
public FlipTile(DiffuseMaterial frontMaterial,
Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
{
m_locationDesired = new Point3D(center.X, center.Y, 0);
m_locationCurrent = new Point3D(0, 0, Util.Rnd.NextDouble() * 10 - 20);
m_size = size;
Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);
m_frontMaterial = frontMaterial;
Model3DGroup quad = new Model3DGroup();
quad.Children.Add(
CreateTile(
frontMaterial,
backMaterial,
m_borderMaterial,
new Size3D(size.Width, size.Height, .01),
backTextureCoordinates));
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new RotateTransform3D(m_verticalFlipRotation));
group.Children.Add(new RotateTransform3D(m_quaternionRotation3D));
group.Children.Add(m_scaleTransform);
group.Children.Add(m_translate);
quad.Transform = group;
this.Visual3DModel = quad;
}
示例14: YPitchBendCube
public YPitchBendCube(Point3D center, double radius,
Pitch pitch, Instrument instrument, OutputDevice device, Channel channel)
: base(center, radius, new InstrumentNoteAction(device, channel, pitch)) {
outputDevice = device;
this.channel = channel;
}
示例15: TryTransform
/// <summary>
/// Transform a point
/// </summary>
/// <param name="inPoint">Input point</param>
/// <param name="result">Output point</param>
/// <returns>True if the point was transformed successfuly, false otherwise</returns>
public bool TryTransform(Point inPoint, out Point3D result)
{
Point final2DPoint;
// assign this now so that we can return false if needed
result = new Point3D();
if (!_transform2D.TryTransform(inPoint, out final2DPoint))
{
return false;
}
Point texCoord = Viewport2DVisual3D.VisualCoordsToTextureCoords(final2DPoint, _childBounds);
// need to walk the texture coordinates on the Viewport2DVisual3D
// and look for where this point intersects one of them
Point3D coordPoint;
if (!Viewport2DVisual3D.Get3DPointFor2DCoordinate(texCoord,
out coordPoint,
_positions,
_textureCoords,
_triIndices))
{
return false;
}
if (!_transform3D.TryTransform(coordPoint, out result))
{
return false;
}
return true;
}