How can I redimension the size of the list of spheres but not depending on the spheres' position?
I have an ensemble of 200-300 spheres and I want to redimension them proportionally, in order so that the nodes are the same size visually.
I want all the nodes to have the same dimension indifferent to the node position. In my case, when I zoom the camera with the mouse, many nodes (spheres) will not be seen.
This is the codebase:
// for nodes (list of sphere visual 3d)
for (int i = 0; i < nodes.Count; i++)
{
try
{
var centerPoint = new Point3D(0, 0, 0);
var selectedNodes = nodes.Where(s => s.Radius == 0.51).ToList();
if (selectedNodes.Count() == 1)
{
centerPoint = selectedNodes[0].CenterPosition;
}
Size worldSize = Camera1.GetWorldSize(new Size(6.2, 2), centerPoint); // not sure how it works (to be investigated)
var scaleTransform3D = nodes[i].Transform as ScaleTransform3D; // not sure how it works (to be investigated)
scaleTransform3D = new ScaleTransform3D();
// To prevent scaling the position (multiplying it with the scale factor), we need to set the center of scale
scaleTransform3D.CenterX = nodes[i].CenterPosition.X;
scaleTransform3D.CenterY = nodes[i].CenterPosition.Y;
scaleTransform3D.CenterZ = nodes[i].CenterPosition.Z;
nodes[i].Transform = scaleTransform3D;
double scaleFactor = worldSize.Width / 1;
scaleTransform3D.ScaleX = scaleFactor;
scaleTransform3D.ScaleY = scaleFactor;
scaleTransform3D.ScaleZ = scaleFactor;
}
catch { }
}
I have an ensemble of 200-300 spheres and I want to redimension them proportionally, in order so that the nodes are the same size visually.
I want all the nodes to have the same dimension indifferent to the node position. In my case, when I zoom the camera with the mouse, many nodes (spheres) will not be seen.
This is the codebase:
// for nodes (list of sphere visual 3d)
for (int i = 0; i < nodes.Count; i++)
{
try
{
var centerPoint = new Point3D(0, 0, 0);
var selectedNodes = nodes.Where(s => s.Radius == 0.51).ToList();
if (selectedNodes.Count() == 1)
{
centerPoint = selectedNodes[0].CenterPosition;
}
Size worldSize = Camera1.GetWorldSize(new Size(6.2, 2), centerPoint); // not sure how it works (to be investigated)
var scaleTransform3D = nodes[i].Transform as ScaleTransform3D; // not sure how it works (to be investigated)
scaleTransform3D = new ScaleTransform3D();
// To prevent scaling the position (multiplying it with the scale factor), we need to set the center of scale
scaleTransform3D.CenterX = nodes[i].CenterPosition.X;
scaleTransform3D.CenterY = nodes[i].CenterPosition.Y;
scaleTransform3D.CenterZ = nodes[i].CenterPosition.Z;
nodes[i].Transform = scaleTransform3D;
double scaleFactor = worldSize.Width / 1;
scaleTransform3D.ScaleX = scaleFactor;
scaleTransform3D.ScaleY = scaleFactor;
scaleTransform3D.ScaleZ = scaleFactor;
}
catch { }
}