11-22-2017, 09:05 PM
I'm having a problem where the colors I've assigned to objects (Points and lines) change when I switch views. Typically they switch to the color of the first item I create. So if I create a grid of 9 blue points then one orange line, when I change views (from top-down to 3D) the line switches from orange to blue then stays that color after that. In addition, the first time I run my program and read the data it displays blue/orange. However, if I clear the data then re-read the file the same information shows blue/blue. I have had this problem from day one, but I'm finally getting around to trying to fix it.
I'm using a variant of the tutorial SceneView3D. (C#, WPF)
For the line I'm using a PolyLineVisual3D and the points are PixelsVisual3D. The colors are a SolidColorBrush color (System.Windows.Media.Color).
Any thoughts as to what I'm doing wrong or where to look? I have verified that the code that sets the color is only getting called once at object creation.
Here is the code where I set the colors:
Points:
Line:
I'm using a variant of the tutorial SceneView3D. (C#, WPF)
For the line I'm using a PolyLineVisual3D and the points are PixelsVisual3D. The colors are a SolidColorBrush color (System.Windows.Media.Color).
Any thoughts as to what I'm doing wrong or where to look? I have verified that the code that sets the color is only getting called once at object creation.
Here is the code where I set the colors:
Points:
Code:
// The easiest way to show many pixels is to use PixelsVisual3D.
var pixelsVisual3D = new PixelsVisual3D()
{
Positions = _positionsArray, // Vector3[]
PixelColor = Brush.Color, // SolidColorBrush.Color
PixelSize = 4.0 //pixelSize
};
Line:
Code:
var polyLineVisual3D = new PolyLineVisual3D()
{
Positions = _ptArray, // Point3DCollection
LineThickness = thickness, // double
LineColor = brush.Color, // SolidColorBrush.Color
IsClosed = false // bool
};