以编程方式创建 WPF 3D 立方体

发布于 2024-08-21 14:25:38 字数 68 浏览 0 评论 0原文

在 wpf 中以编程方式创建 GeometryModel3D 立方体的最简单方法是什么?

What is the simplest way to programmatically create a GeometryModel3D cube in wpf?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的憧憬 2024-08-28 14:25:38

最简单方法?这一切都取决于您的观点。

我想说这种事情非常“简单”:

return new GeometryModel3D
{
  Material = ...,
  Geometry = new Geometry
  {
    Points = new Point3DCollection
    {
      new Point3D(0,0,0),
      ...
    },
    TriangleIndices = new Int32Collection
    {
      ...
    },
    ...
  },
  ...
};

但其他人可能会认为对 XamlReader.Parse("...put your xaml here...") 的一次调用更简单。

这是一个判断。

The simplest method? It all depends on your point of view.

I'd say this kind of thing is pretty "simple":

return new GeometryModel3D
{
  Material = ...,
  Geometry = new Geometry
  {
    Points = new Point3DCollection
    {
      new Point3D(0,0,0),
      ...
    },
    TriangleIndices = new Int32Collection
    {
      ...
    },
    ...
  },
  ...
};

But others might consider a single call to XamlReader.Parse("...put your xaml here...") as more simple.

It's a judgement call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文