Skip to content

Instantly share code, notes, and snippets.

View komasaru's full-sized avatar

mk-mode komasaru

View GitHub Profile
@komasaru
komasaru / blh2enu.cpp
Last active September 16, 2021 08:25
C++ source code to convert a coordinate from WGS84(BLH) to ENU.
/***********************************************************
BLH -> ENU 変換
: WGS84 の緯度(Beta)/経度(Lambda)/楕円体高(Height)を
ENU (East/North/Up; 地平) 座標に変換する。
* 途中、 ECEF(Earth Centered Earth Fixed; 地球中心・地
球固定直交座標系)座標への変換を経由。
DATE AUTHOR VERSION
2021.05.06 mk-mode.com 1.00 新規作成
@komasaru
komasaru / ecef2blh.cpp
Last active May 6, 2021 01:06
C++ source code to convert a coordinate from ECEF to WGS84(BLH).
/***********************************************************
ECEF -> BLH 変換
: ECEF(Earth Centered Earth Fixed; 地球中心・地球固定直交座標系)座標を
WGS84 の緯度(Latitude)/経度(Longitude)/楕円体高(Height)に変換する。
DATE AUTHOR VERSION
2021.05.02 mk-mode.com 1.00 新規作成
Copyright(C) 2021 mk-mode.com All Rights Reserved.
@komasaru
komasaru / blh2ecef.cpp
Last active May 6, 2021 01:02
C++ source code to convert a coordinate from WGS84(BLH) to ECEF.
/***********************************************************
BLH -> ECEF 変換
: WGS84 の緯度(Beta)/経度(Lambda)/楕円体高(Height)を
ECEF(Earth Centered Earth Fixed; 地球中心・地球固定直交座標系)座標に
変換する。
DATE AUTHOR VERSION
2021.04.30 mk-mode.com 1.00 新規作成
Copyright(C) 2021 mk-mode.com All Rights Reserved.
@komasaru
komasaru / mean_time.cpp
Last active February 9, 2021 02:13
C++ source code to calculate a mean of 2 timespecs.
/***********************************************************
2つの時刻(timespec)の平均を計算
DATE AUTHOR VERSION
2021.02.06 mk-mode.com 1.00 新規作成
Copyright(C) 2020 mk-mode.com All Rights Reserved.
----------------------------------------------------------
引数 : JST_1 JST_2
@komasaru
komasaru / calc.cpp
Created October 15, 2020 01:16
C++ source code to calculate a Lorenz attractor by Runge-Kutta's method.
#include "calc.hpp"
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
namespace my_lib {
@komasaru
komasaru / calc.cpp
Created October 15, 2020 01:02
C++ source code to calculate a Lorenz attractor by Euler's method.
#include "calc.hpp"
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
namespace my_lib {
@komasaru
komasaru / infix2rpn_bt.cpp
Created October 13, 2020 00:43
C++ source code to convert a formula string to a RPN with a binary tree.
/***************************************************************
Convert an infix formula to an RPN (by binary tree).
(Unary operators are not supported)
DATE AUTHOR VERSION
2020.10.08 mk-mode.com 1.00 新規作成
Copyright(C) 2020 mk-mode.com All Rights Reserved.
***************************************************************/
#include <iostream> // for cout
@komasaru
komasaru / rpn.cpp
Created October 12, 2020 01:28
C++ source code to calculate a formula expressed with RPN.
/***************************************************************
Caculate a formula string by RPN.
DATE AUTHOR VERSION
2020.10.07 mk-mode.com 1.00 新規作成
Copyright(C) 2020 mk-mode.com All Rights Reserved.
***************************************************************/
#include <iostream> // for cout
#include <regex> // for regex_search.
@komasaru
komasaru / infix2rpn.cpp
Created October 12, 2020 01:20
C++ source code to convert a formula string to a RPN.
/***************************************************************
Convert an infix formula to an RPN.
(Unary operators are not supported)
DATE AUTHOR VERSION
2020.10.05 mk-mode.com 1.00 新規作成
Copyright(C) 2020 mk-mode.com All Rights Reserved.
***************************************************************/
#include <iostream> // for cout
@komasaru
komasaru / infix2rpn_bt.rb
Last active October 8, 2020 01:09
Ruby script to convert a formula string to a RPN by binary tree.
#! /usr/local/bin/ruby
#*********************************************************
# Ruby script to convert string to RPN (by binary tree).
# (Unary operators are not supported)
#*********************************************************
class Node
attr_reader :expr
def initialize(expr)