第一颗卫星

garfileo

``````#macro UV_to_XYZ(U, V)
vrotate(vrotate(-z, V * x), -U * y)
#end``````

``#declare A = UV_to_XYZ(118.41, 34.61);``

`Z_A` 轴很容易构造出来：

``#declare Z_A = vnormalize(<0, 0, 0> - A);``

``````#declare X_A = vrotate(x, -118.41 * y);
#declare Y_A = vrotate(vrotate(y, 34.61 * x), -118.41 * y);``````

``MakeFrame(A, X_A, Y_A, Z_A, 0.25, 0.01)``

``````camera  {
location A
right X_A
up Y_A
direction Z_A
}``````

``````camera  {
location A - 3.5 * Z_A
right X_A
up Y_A
direction Z_A
}``````

``````camera  {
location A
right X_A
up Y_A
direction Z_A
translate -3.5 * Z_A
}``````

`right` 的含义是相机的右侧方向。`up` 的含义是相机的顶部方向。`direction` 的含义是相机镜头的方向。这三个方向再加上 `location`，便完全确定了相机的方位。至于这个相机拍摄到的图像为何是扁的，是因为相机认为要拍摄的画面是个正方形，即画面的宽度和高度相同，但是我给它的底片却是长方形的，所以相机不得不把它拍摄到的正方形画面压扁，印到底片上。

``````camera  {
location A
right (image_width/image_height) * X_A
up Y_A
direction Z_A
translate -3.5 * Z_A
}``````

``````camera  {
location A - 3.5 Z_A
sky Y_A
look_at <0, 0, 0>
}``````

POV Ray 能够根据 `sky``look_at` 的值自动为我计算出上面的相机信息。

``````#version 3.7;
#include "colors.inc"
global_settings {
assumed_gamma 1.0
}

// 天球
sphere {
<0, 0, 0>, 1
texture { pigment { color rgbt <0, 0, 1, 0.75> } }
hollow // 令球体中空
}

#macro MakeAxis(Origin, Direction, Length, Thickness, Color)
#local ArrowLength = 0.3 * Length;
#local Direction = vnormalize(Direction);
#local Begin = Origin;
#local End = Begin + (Length - ArrowLength) * Direction;
#local ArrowBegin = End;
#local ArrowEnd = ArrowBegin + ArrowLength * Direction;
object {
union {
cylinder {
Begin, End
Thickness
texture { pigment { color Color } }
}
cone {
ArrowBegin, 2 * Thickness
ArrowEnd, 0
texture { pigment { color Color } }
}
}
}
#end

#macro MakeFrame(A, X_A, Y_A, Z_A, L, Thickness)
object {
union {
sphere {
A, 2 * Thickness
texture { pigment { color Gray50 } }
}
MakeAxis(A, X_A, L, Thickness, Red)
MakeAxis(A, Y_A, L, Thickness, Green)
MakeAxis(A, Z_A, L, Thickness, Blue)
}
}
#end

// 世界坐标系
MakeFrame(<0, 0, 0>, x, y, z, 2, 0.025)

#declare line_thickness = 0.015;

torus {
1, line_thickness
texture { pigment { color Orange } }
}

torus {
#local theta = (34.61 / 180) * pi;
cos(theta), line_thickness
texture { pigment { color Orange } }
translate sin(theta) * y
}

#declare Monster = box { <-1.5, -1.5, 0>, <1.5, 1.5, 1.5> }
#declare PrimeMeridian = difference {
torus {
1, line_thickness
rotate 90 * z
texture { pigment { color Orange } }
}
Monster
}

// 本初子午线
PrimeMeridian

// 东经 118.41
object {
PrimeMeridian
rotate -118.41 * y
}

#macro UV_to_XYZ(U, V)
vrotate(vrotate(-z, V * x), -U * y)
#end

#declare A = UV_to_XYZ(118.41, 34.61);
#declare X_A = vrotate(x, -118.41 * y);
#declare Y_A = vrotate(vrotate(y, 34.61 * x), -118.41 * y);
#declare Z_A = vnormalize(<0, 0, 0> - A);

MakeFrame(A, X_A, Y_A, Z_A, 0.5, 0.025)

light_source {
<5, 5, -5>
color White
}

camera  {
location A
right (image_width / image_height) * X_A
up Y_A
direction Z_A
translate -3.5 * Z_A
}``````

5.7k 声望
1.8k 粉丝
0 条评论