Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica 数学中的第一人称结构观_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica 数学中的第一人称结构观

Wolfram mathematica 数学中的第一人称结构观,wolfram-mathematica,Wolfram Mathematica,上面的代码在计算时给出了以下图像 我想在飞机上看到这些图像的第一人称视图。我希望能够在平面上移动图像作为结构,并有机会像原始视图一样移动 有什么办法可以做到吗。我们可以有一个可以在x轴上移动的对象,它可以绕x轴移动,并且可以让我们看到x轴、y轴和z轴可以通过参数改变的结构吗?这是您想要的吗 (* code to Construct structures *) wing = { (*Base Cylinders*) {Gray, Cylinder[{{10, 10, 10}, {10, 1

上面的代码在计算时给出了以下图像

我想在飞机上看到这些图像的第一人称视图。我希望能够在平面上移动图像作为结构,并有机会像原始视图一样移动

有什么办法可以做到吗。我们可以有一个可以在x轴上移动的对象,它可以绕x轴移动,并且可以让我们看到x轴、y轴和z轴可以通过参数改变的结构吗?

这是您想要的吗

(* code to Construct structures *)

wing = {
(*Base Cylinders*)
 {Gray, Cylinder[{{10, 10, 10}, {10, 10, 6}}, 7]},
 {Blue, Cylinder[{{10, 10, 6}, {10, 10, 5}}, 7]},
 {Blue, Cylinder[{{10, 10, 5}, {10, 10, 4}}, 7]},
 {Gray, Cylinder[{{10, 10, 4}, {10, 10, 2}}, 7]},

 (*top cylinders*)
 {Blue, Cylinder[{{10, 10, 12}, {10, 10, 10}}, 4]},
 {Gray, Cylinder[{{10, 10, 14}, {10, 10, 12}}, 4]},

 (*Parallel Beamers*)
 {Gray, Cuboid[{0, 7, 12}, {20, 13, 2}]}};

  house = {
  (*the house*)
  {Darker[Red, 0.3], Cuboid[{-10, -10, 0}, {2, 3, 12}]},

   (*roof*)
   {Darker[Brown, 0.4], 
   Polygon[{{-10, -10, 12}, {-4, -3, 18}, {2, -10, 12}}]},
   {Darker[Brown, 0.4], 
   Polygon[{{2, -10, 12}, {-4, -3, 18}, {2, 3, 12}}]},
   {Darker[Brown, 0.4], 
   Polygon[{{2, 3, 12}, {-4, -3, 18}, {-10, 3, 12}}]},
   {Darker[Brown, 0.4], 
    Polygon[{{-10, 3, 12}, {-4, -3, 18}, {-10, -10, 12}}]},

    (*Door*)
   {Yellow, 
   Polygon[{{2.005, -5.25, 0}, {2.005, -5.25, 5}, {2.005, -1.75, 
   5}, {2.005, -1.75, 0}}]},
   (*Door Knob*)
   {Orange, Sphere[{2.005, -2.25, 2.5}, 0.25]},
   (*Windows*)
   {Lighter[Blue, 0.5], 
   Polygon[{{2.005, -9, 6}, {2.005, -9, 10}, {2.005, -5, 
   10}, {2.005, -5, 6}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{2.005, -1.75, 6}, {2.005, -1.75, 10}, {2.005, 2, 
   10}, {2.005, 2, 6}}]},

   (*Chimney*)
   {Gray, Cuboid[{-2, -9, 12.75}, {-5, -7, 17}]},

   (*Lines for the Window*)
   {Black, Cuboid[{2.006, -9, 7.9}, {2.006, -5, 8.1}]},
   {Black, Cuboid[{2.006, -7.1, 6}, {2.006, -6.9, 10}]},
   {Black, Cuboid[{2.006, 0, 6}, {2.006, 0.2, 10}]},
   {Black, Cuboid[{2.006, -1.75, 7.9}, {2.006, 2, 8.1}]},

   (*Lawn*)
   {Darker[Green, 0.5], 
    Polygon[{{2, -10, 0}, {2, 3, 0}, {-10, 3, 0}, {-10, 10, 0}, {2, 
    10, 0}, {10, 10, 0}, {10, -10, 0}}]},

   (*Pavement*)
   {Darker[Gray, 0.5], 
   Polygon[{{2, -5.25, 0.005}, {2, -1.75, 0.005}, {10, -1.75, 
   0.005}, {10, -5.25, 0.005}}]},
   (*Side Windows*)
   {Lighter[Blue, 0.5], 
   Polygon[{{1, 3.005, 2}, {1, 3.005, 5}, {-4, 3.005, 5}, {-4, 3.005,
    2}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{-5, 3.005, 7}, {-9, 3.005, 7}, {-9, 3.005, 10}, {-5, 
   3.005, 10}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{0, 3.005, 7}, {0, 3.005, 11}, {-2, 3.005, 11}, {-2, 
   3.005, 7}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{-6, 3.005, 2}, {-6, 3.005, 6}, {-8, 3.005, 6}, {-8, 
   3.005, 2}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{1, -10.005, 2}, {1, -10.005, 5}, {-4, -10.005, 
   5}, {-4, -10.005, 2}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{-5, -10.005, 7}, {-9, -10.005, 7}, {-9, -10.005, 
   10}, {-5, -10.005, 10}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{0, -10.005, 7}, {0, -10.005, 11}, {-2, -10.005, 
   11}, {-2, -10.005, 7}}]}, {Lighter[Blue, 0.5], 
   Polygon[{{-6, -10.005, 2}, {-6, -10.005, 6}, {-8, -10.005, 
   6}, {-8, -10.005, 2}}]},


   (*Back Window*)
   {Lighter[Blue, 0.5], 
   Polygon[{{-10.005, 1, 3}, {-10.005, 1, 9}, {-10.005, -8, 
   9}, {-10.005, -8, 3}}]},

    (*Lines for the Window*)
   {Black, Cuboid[{-1.4, 3.006, 2}, {-1.6, 3.006, 5}]},
   {Black, Cuboid[{1, 3.006, 3.4}, {-4, 3.005, 3.6}]},
   {Black, Cuboid[{-6.85, 3.006, 7}, {-7.1, 3.006, 10}]},
   {Black, Cuboid[{-5, 3.006, 8.4}, {-9, 3.006, 8.6}]},
   {Black, Cuboid[{-1.4, -10.006, 2}, {-1.6, -10.006, 5}]},
   {Black, Cuboid[{1, -10.006, 3.4}, {-4, -10.005, 3.6}]},
   {Black, Cuboid[{-6.85, -10.006, 7}, {-7.1, -10.006, 10}]},
   {Black, Cuboid[{-5, -10.006, 8.4}, {-9, -10.006, 8.6}]}};

    (* Holds the constructions together *)

  tab = HoldForm@{
  place[wing, 2, {0, 70, -27}, 0, "Building1"],
  place[house, 1, {170, 200, -50}, 0, "Building2"]};

    (* defining the function place in the above function *)

   place[obj_, scale_, trans_, rotate_, name_] := 
   GeometricTransformation[obj, 
   ScalingTransform[scale {1, 1, 1}].TranslationTransform[
   trans].RotationTransform[rotate Degree, {0, 0, 1}]]

   (* Function to show the images in a particular plane *)

    view := Show[
    Graphics3D[ReleaseHold[tab], PlotRange -> Automatic, 
     ImageSize -> {500, 500}, Boxed -> True, 
    AxesLabel -> {"x", "y", "z"}, Axes -> True]];




    (*--------------code over ----------------------------------------------------*)
可能会帮助您更好地理解
ViewVector
ViewAngle
等概念。下面的代码可以让您在特定示例中稍微试验一下相机的位置和视角如何影响视图。
选项卡的代码与原始问题相同

Manipulate[
 Show[Graphics3D[ReleaseHold[tab], PlotRange -> Automatic, 
   ImageSize -> {500, 500}, Boxed -> True, 
   AxesLabel -> {"x", "y", "z"}, Axes -> True, 
   ViewPoint -> {x, y, z}]], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]


左边的图像显示了建筑物的鸟瞰图,其中红点是摄像机的位置,圆锥体是视野。

我想您需要
视点
选项。顺便说一下,现在有一个Mathematica特定的StackExchange:顺便说一句,您发布的代码似乎只包括小房子,这就足够了。此外,用降价“格式化”代码也不是一个好主意。在我的Mathematica安装工作之前,我必须清理它。您可以通过使用alt左键单击鼠标移动(in/out)、alt shift左键单击鼠标移动(rotations)和shift左键单击鼠标移动(up/down/left/right)来进行一些特殊的缩放。但是不可能在绘图中移动POV。特别的缩放功能可以工作,但是,我希望有一个像相机一样的结构放置在整个平面上的视图。查看youtube上的这段视频:在这段视频中,他像照相机一样在一个建筑物中放大,向你求助。。这看起来不错,但我真正想实现的是一个类似摄影机的视图,以查看内部结构。我在Youtube上看到了一些视频,它们看起来非常棒,但是我无法实现任何接近这一点的效果。如何在操纵上使用ViewAngle和ViewVector,使其在移动时更像摄影机。
With[{xrange = {0, 180}, yrange = {150, 240}, zrange = {-50, 0}},
 Manipulate[
  DynamicModule[{vv, crd},
   With[{gr = Graphics3D[ReleaseHold[tab], 
       PlotRange -> {xrange, yrange, zrange}, ImageSize -> {500, 500},
       Boxed -> True, AxesLabel -> {"x", "y", "z"}, Axes -> True], eyelevel = -48},

    crd = {Cos[phi] Sin[theta], Sin[theta] Sin[phi], Cos[theta]};
    vv = {Append[{ptx, pty}, eyelevel], Append[{ptx, pty}, eyelevel] + crd};

    Grid[{{Show[{gr,
         Graphics3D[{{Red, Sphere[vv[[1]], .5]},
           {Opacity[.3], Cone[{vv[[1]] + 100 crd, vv[[1]]}, 100 Tan[a/2]]}}]}, 
        ImageSize -> 350],
       Show[gr, Axes -> False, ViewVertical -> {0, 0, 1}, 
        ViewVector -> vv, ViewAngle -> a , ImageSize -> 350]}}]]],
  {{a, 50 Degree, "View Angle"}, 10 Degree, 180 Degree},
  {{ptx, 100, "Camera Position x"}, Sequence @@ xrange},
  {{pty, 200, "Camera Position y"}, Sequence @@ yrange},
  {{phi, Pi, "Horizontal Angle"}, 0, 2 Pi},
  {{theta, Pi/2, "Vertical Angle"}, 0, Pi}]]