Im tryint使用ILNumerics绘制线框圆柱体。
var CylinderShape = new ILCylinder();
CylinderShape.Top.Fill.Color = c;
CylinderShape.Top.Border.Width = 3;
CylinderShape.Top.Border.Color = Color.Black;
CylinderShape.Hull.Color = c;
CylinderShape.Bottom.Fill.Color = c;
CylinderShape.Bottom.Border.Width = 3;
CylinderShape.Bottom.Border.Color = Color.Black;
但是CylinderShape.Hull不具有border属性。我尝试将RectangleWireframe添加到场景中以解决我的问题:
var WireframeShape = Shapes.RectangleWireframe;
WireframeShape.Antialiasing = true;
WireframeShape.Width = 3;
WireframeShape.DashStyle = DashStyle.Solid;
但是创建的形状不好。 如何用线替换RectangleWireframe以绘制线框圆柱体?
完整来源是:
private static ILGroup Cylinder(double x, double y, double z, double bw, double bh, Color c)
{
ILGroup returnValue = new ILGroup();
var Wireframe = new ILGroup();
var WireframeShape = Shapes.RectangleWireframe;
WireframeShape.Antialiasing = true;
WireframeShape.Width = 3;
WireframeShape.DashStyle = DashStyle.Solid;
Wireframe.Add(WireframeShape);
ILGroup Cylinder = new ILGroup();
var CylinderShape = new ILCylinder();
CylinderShape.Top.Fill.Color = c;
CylinderShape.Top.Border.Width = 3;
CylinderShape.Top.Border.Color = Color.Black;
CylinderShape.Hull.Color = c;
CylinderShape.Bottom.Fill.Color = c;
CylinderShape.Bottom.Border.Width = 3;
CylinderShape.Bottom.Border.Color = Color.Black;
Cylinder.Add(CylinderShape);
Cylinder.Rotate(new Vector3(1, 0, 0), Math.PI / 2);
Cylinder.Scale(bw / 2, bh, bw / 2);
Cylinder.Translate(bw / 2, 0, bw / 2);
Wireframe.Scale(bw, bh*0.95, bw);
Wireframe.Translate(-bw / 2, 0, bw / 2);
Wireframe.Rotate(0, 1, 0, -90 * Math.PI / 360);
returnValue.Add(Cylinder);
returnValue.Add(Wireframe);
returnValue.Translate(x, y, z);
return returnValue;
}
结果是: Created image