Skip to content

Commit

Permalink
Fix Mercator Inv.
Browse files Browse the repository at this point in the history
  • Loading branch information
aitch-two committed Dec 23, 2013
1 parent 1b20ec7 commit 030c050
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Ricoh THETAなどが出力する正距円筒図法(Equirectangular projection
1. Paint.NETを起動中なら、Paint.NETを終了する
2. Paint.NETをインストールしたフォルダのEffectsフォルダから、
該当のDLLファイルを削除する
通常は「C:\Program Files\Paint.NET\Effects」にコピー
通常は「C:\Program Files\Paint.NET\Effects」から削除

**Paint.NETをアンインストール**

Expand Down Expand Up @@ -143,7 +143,7 @@ Ricoh THETAに対応していない正距円筒画像表示ソフトでも正し
変換後の画像の中央方向・画像の傾きを指定します

- **Projection**
投影方法を選択します。
投影方法を選択します。
- Equidistance(等距離射影方式)
ほとんどの魚眼レンズで採用されている射影方式。
最大画角は360°で全天球を含むことができる。
Expand Down
6 changes: 3 additions & 3 deletions src/MercatorProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Icon: MercatorProjection.png
// Support Information
// Author: @aitch_two
// DLL Version: 1.0
// DLL Version: 1.1
// URL: https://github.com/aitch-two/THETATools

void Render(Surface dst, Surface src, Rectangle rect)
Expand Down Expand Up @@ -71,7 +71,7 @@ protected override Vec2d vec3d2vec2d(Vec3d vec) {

class MercatorProjection : Projection {
private readonly double r;
public MercatorProjection (Surface fb, Mat3d mat) : base(fb, mat, true) {
public MercatorProjection (Surface fb, Mat3d mat) : base(fb, mat, false) {
r = fb.Width / 2 / Math.PI;
}
protected override Vec3d vec2d2vec3d(Vec2d i) {
Expand All @@ -82,7 +82,7 @@ protected override Vec2d vec3d2vec2d(Vec3d vec) {
try {
return new Vec2d(
center.x + fb.Width / 2.0 * Math.Atan2(vec.x, vec.z) / Math.PI,
center.y + r * vec.y / vec.z);
center.y + r * vec.y / Math.Sqrt(vec.x * vec.x + vec.z * vec.z));
} catch(ArithmeticException) {
return Vec2d.invalid;
}
Expand Down

0 comments on commit 030c050

Please sign in to comment.