0

Setting SphereVisual3D center

Anonymous 10 years ago 0
This discussion was imported from CodePlex

lmat619 wrote at 2012-06-13 23:03:

Hey Objo. I'm trying to change the center of a SphereVisual3D object and make it a 2D object by setting the Z parameter to 0. The problem is it won't flatten the sphere. Is there any way to do this? Or is there any other way to make a 2D filled in circle using your toolkit? Thanks. Here's my code:

 

private void Mouse_Down(object sender, MouseButtonEventArgs e)
{
     lineOne = (Point3D)GetPoints(e);
}

private void Mouse_Up(object sender, MouseButtonEventArgs e)
{
     lineTwo = (Point3D)GetPoints(e);
     SphereVisual3D sphere = new SphereVisual3D();
     sphere.Center = new Point3D((lineOne.X + lineTwo.X) / 2, (lineOne.Y + lineTwo.Y) / 2, 0);
     sphere.Radius = Math.Abs(lineOne.X - lineTwo.X) / 2;
     viewport.Children.Add(sphere);
}

objo wrote at 2012-06-15 06:09:

Try a ScaleTransform3D(1,1,0). I am not sure it will look good, but it should flatten the sphere..

http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.scaletransform3d.aspx