2024,江端さんの忘備録

Raspberry PI4(ラズパイ4)で、ある特定のDockerコンテナが動かないので、頭を抱えています。

I have a headache because a particular Docker container is not working on my Raspberry PI4 (Raspberry PI4).

ラズパイ4から、CPUがAMD(CISCチップ)から、ARM(RISCチップ)に変わりました。

From Raspi 4, the CPU has changed from AMD (CISC chip) to ARM (RISC chip).

ラズパイが、このサイズ(名刺サイズ)のままで、性能を上げるには、低電力消費と高性能を組み合わせたRISC(Reduced Instruction Set Computing)アーキテクチャを使わなければ、やっていけないというのは分かります。

I understand that Raspi cannot do without RISC (Reduced Instruction Set Computing) architecture, which combines low power consumption and high performance, to increase performance at this size (business card size).

しかし、そういう「過渡期をつき合わされるエンジニア」にとっては、災難です。

However, it is a disaster for the engineers dealing with such "transitional periods.

「上司からの、突然の飲み会の誘い」よりも、災難です。

It's more of a disaster than "a surprise invitation for a drink from your boss."

Dockerコンテナは、チップとかOSとかに関係なく動く ―― というのが建前ですが、そうでないことは結構あります。

Docker containers work regardless of chip or OS -- the building block is that they work irrespective of chip or OS, but that's pretty much not the case.

特に、ラズパイでは、私は、この問題に度々巻き込まれてきました。

I have often run into this problem, especially with Raspi.

----

さて、このような、システム変更の問題によって「溶けていく時間」をどのように把握するか、重要です。

Understanding how to figure out the "time to melt" due to these system change issues is essential.

このような時間を、『生産性のない時間の無駄遣い』と見るか、はたまた、『将来への必要な先行投資』と見るか、です。

Do you see such time as an 'unproductive waste of time' or a 'necessary up-front investment for the future'?

実のところ、この議論は、あまり意味がありません。

This argument does not make much sense.

というのは、この手の技術上の課題は、放置しておけば、必ず解決するからです。

This type of technical challenge will always be solved if left alone.

今度もコンピュータの性能は上がり続けますし、チップの変更によって動かなくなったソフトウェアもいずれ動くようになります。

Computers will continue to improve, and software that stopped working because of the chip change will eventually work again.

そういうことを、頑張ってくれる人がいるからです。

That's the kind of thing that people do their best to do.

そういう人たちの成果の「おこぼれ」を、ありがたく頂くことができるのが、このデジタル業界です。

In the digital industry, we can take advantage of the achievements of such people.

-----

先行技術が汎用化されていく時間は恐しく短く、先行開発によって得られる先行者利益は、それほど大きくありません。

The time it takes for prior art to become generalized is frighteningly short, and the first-mover advantage gained from previous development is not great.

先行技術者の利益を守る為に『特許法』というものがあるのですが、デバイス、材料、機械の発明などには、一定の効果があると思います。

There is a "patent law" to protect the interests of prior art inventors, and I believe it has specific effects on device, material, and machine inventions.

しかし、デジタルシステムの発明は、特許法による保護を受けにくいのです。

However, inventions in digital systems are less likely to be protected by patent law.

まず、アルゴリズム自体に特許性がなく(日本では、そう決めている)、そして、侵害立証が死ぬほど難しく、立証できたとしても、取り立てられる金額がショボイからです。

First, the algorithm itself is not patentable (JPO has decided that), and second, it is deathly challenging to prove infringement. Even if we prove it, the amount of money we can get is paltry.

では、なぜ、大手の企業は、金にもならない特許出願を、エンジニアの社員たちに強いているかというと ―― 他社に対して「マウント」を取るためです。

So, why do significant companies force their engineering employees to apply for patents that don't pay well -- to "mount" other companies?

ある特定の技術分野を、沢山の数の特許出願(別に特許査定されていなくてもいい)で埋めつくすことで、「縄張り」を主張するためです。

The purpose is to claim "territory" by filling a particular technical field with many patent applications (even without Patent approval).

「技術フィールドにおける、実効占拠」という感でしょうか。

It may be a sense of "effective occupation of the technological field.

要するに『ここシマに入っているんじゃねーぞ』です。

In short, 'We're in this territory here.'

やっていることは「合法」ですが、その本質は「反社」と同じです。

What they are doing is "legal," but the essence of it is the same as "anti-socialism."

-----

資本主義経済とは、つまるところ「シマ争い」です。

A capitalist economy is, after all, a "territory war.

私もまた、組織の下っ端の構成員として、「チャカ(拳銃)」ではなく、「ネタ(アイデア)」で、組織のシノギを守っている、ということです。

As a lowly member of the organization, I am also protecting the organization's security not with a "Chaka" (gun) but with a "neta" (idea).

愛のある特許出願

未分類

https://airensoft.gitbook.io/ovenmediaengine/getting-started
のコピペ

オーブンメディアエンジン

 

はじめる

Docker イメージの使用を開始する

OvenMediaEngine は、AirenSoft の Docker Hub (airensoft/ovenmediaengine) リポジトリから Docker イメージを提供します。 Dockerイメージを利用することで簡単にOvenMediaEngineサーバーを利用することができます。詳細については、「Docker 入門」を参照してください。

ソースコードの入門
依存関係のインストール

OvenMediaEngine は、さまざまなオープンソースやライブラリと連携できます。まず、以下で説明するように、これらをクリーンな Linux マシンにインストールします。 OME はほとんどの Linux パッケージをサポートできると考えていますが、使用するテスト済みのプラットフォームは Ubuntu 18 以降、Fedora 28 以降、および CentOS 7 以降です。

curl -LOJ https://github.com/AirenSoft/OvenMediaEngine/archive/v0.16.5.tar.gz && \
tar xvfz OvenMediaEngine-0.16.5.tar.gz && \
OvenMediaEngine-0.16.5/misc/prerequisites.sh

prerequisites.sh スクリプトが失敗した場合は、実行しsudo apt-get updateて再実行してください。これで十分でない場合は、手動インストールに進みます。

構築と実行

次のコマンドを使用して、OvenMediaEngine ソースをビルドできます。

sudo apt-get update
cd OvenMediaEngine-0.16.5/src
make release
sudo make install
systemctl start ovenmediaengine
# If you want automatically start on boot
systemctl enable ovenmediaengine.service 

$ systemctl | grep oven
ovenmediaengine.service loaded active running OvenMediaEngine
と稼働状態を確認できる

Fedora で失敗する場合はsystemctl start ovenmediaengine、SELinux が原因である可能性があります。「トラブルシューティング」の「SELinux の確認」セクションを参照してください。

デフォルトで使用されるポート

デフォルト構成では次のポートが使用されるため、ファイアウォール設定でポートを開く必要があります。

ポート 目的

1935/TCP

RTMP入力

9999/UDP

SRT入力

4000/UDP

MPEG-2 TS入力

9000/TCP

オリジンサーバー (OVT)

3333/TCP 3334/TLS

LLHLS ストリーミング * 非 TLS 経由のストリーミングは、最新のブラウザでは許可されません。

3333/TCP 3334/TLS

WebRTC シグナリング (取り込みとストリーミングの両方)

3478/TCP

WebRTC TCP リレー (TURN サーバー、取り込みとストリーミングの両方)

10000~10009/UDP

WebRTC Ice 候補 (取り込みとストリーミングの両方)

TLS を使用するには、証明書を設定する必要があります。詳細については、「TLS 暗号化」を参照してください。

次の例のようにファイアウォール ポートを開くことができます。

$ sudo firewall-cmd --add-port=3333/tcp
$ sudo firewall-cmd --add-port=3334/tcp
$ sudo firewall-cmd --add-port=1935/tcp
$ sudo firewall-cmd --add-port=9999/udp
$ sudo firewall-cmd --add-port=4000/udp
$ sudo firewall-cmd --add-port=3478/tcp
$ sudo firewall-cmd --add-port=9000/tcp
$ sudo firewall-cmd --add-port=10000-10009/udp

最終更新

 

-----
のコピペ

OvenPlayer

 

Builds

This section describes the development and builds process.

How to write code

OvenPlayer uses npm and webpack when building. If you are using npm for the first time, please refer to Install Node.js, npm. In addition, you need to configure the environment to keep this up-to-date and working.

Environment

If npm works well on your system, run the following command in Terminal to install the packages needed to develop OvenPlayer, such as webpack.

$ npm ci
Production Build

If you want to modify the source code, you need to write it manually.

If you are cloning a project for the first time, you can find already built files in the dist/ directories.

However, you can build your modified source code with the following command. The built source code can be found in the dist/ directory.

npm run build

This command allows you to build the webpack automatically whenever the source code is modified.

Development Build

It is inefficient to build code every time during development and testing. If you use the watch function, webpack detects changes in the source code and automatically builds it quickly. The development built source code can be found in the dev/ directory.

npm run watch

Last updated 

 

2024,江端さんの忘備録

アマゾンプライムの中に、以下のコンテンツが入っていました。

The following content comes to Amazon Prime.

なんとなく、私の直感が「当たり」を告げているような気がして、嫁さんと一緒に視聴を開始しました

Somehow, my intuition told me it was a "hit," and I started watching it with my wife.

「黒書院の六兵衛」

"Rokubei of the Kuro-Shoin room"

嫁さんは、第1回(全6回)で降りてしまいましたが、私は、WebRTCの調査をしながら、このコンテンツを流し見をしていました ―― で、そのまま、朝の4時までかけて、全話見終えてしまいました。

My wife got off after the first episode (6 in all). Still, I was watching this content while investigating the video distribution server -- and I finished watching all the episodes until 4:00 in the morning.

その時は、あまり感じ入っていなかったのですが、次の日の朝、布団の中で、亡き父のことを思い出して、涙が流れ出てきてしまいました。

I didn't feel much at the time, but the next morning, in my futon, I remembered my late father, and tears began to flow.

-----

私が知っている限り、私の父は、私の目の前では、ただの一度も弱音を吐くことなくその人生を終えました ―― 私と真逆です。

As far as I know, my father ended his life without a single moment of weakness in front of me -- the exact opposite of me.

一方、ご存じの通り、私は「痛い」「辛い」「苦しい」「やっていられない」を連発し、それを恥も外分もなく、公開し続けている人間です。

On the other hand, as you know, I am a person who keeps saying "ouch," "painful," "suffering," and "I can't do it," and continues to disclose them without any shame or shame.

私のこの内面と外面を一致させる生き方は、多分、自分の心と体を守るという視点から見れば『多分正しい』。

This way of living that matches my inner and outer life is probably right from the perspective of protecting my mind and body.

しかし、そういうことを一切吐露することなく、沈黙し続けた父は ―― 少なくとも、この私に対しては、多くを語り、そして、伝えきった、と ―― 今ならそう思えます。

However, my father, who remained silent without ever revealing any such thing -- at least to me, he said to me and conveyed to me a lot -- now seems to me that he did.

『父は死んだけど、少なくとも私の中で生きている』 ―― そういうセリフを、私は臆面もなく、しかし、確信を持って、私は言うことができるのです。

My father is dead, but at least he lives on in me' -- lines like that I can say, unabashedly, but with conviction.

まあ、私が死ぬ時に、その時、本当の意味で父も死ぬのだろう、と思います。

Well, I think that when I die, then my father will die too, in the true sense of the word.

そして、それで、いいのです。

And, that's fine.

-----

『私も滅多に見たことがない、満面の笑顔の父です』

の中で、私は、

I wrote the following in my diary,

『しかし、私もこれまでの人生で、"誠実であること"が"誠実でないこと"に、決して負けるものではないことを知るに至っております』

"However, in my life, I have come to know that "honesty" is never inferior to "not honesty."

と書きました。

父は、私に、"これ"を残して逝きました。

My father passed away, leaving me with this.

で、ふと思ったのですが、

And then it occurred to me,

『私も父と同じように、このように誰かに何かを残すことができるだろうか』と考えた時 ――

When I thought, 'Will I be able to leave something like this to someone else like my father did--'

「たぶん無理だろうなぁ」と、今、一人で苦笑しています。

I now chuckle to myself, 'Probably not.'

未分類

「地球から240億キロ、ボイジャー1号システム復旧に成功 5カ月ぶりに解読可能データ受信」

"24 Billion Kilometers from Earth, Voyager 1 System Recovery Successful, Receives First Decipherable Data in Five Months."

という記事を読んで、感極まる人はそれほど多くないかもしれません。

Not many people may be moved to tears when they read an article called

しかし、私は涙が出そうになりました。

However, I almost cried.

『9日間の忍耐』ができるエンジニア ―― これが、SLIMプロジェクトのエンジニアの皆さんと、私の決定的な差です。

はやぶさの映画

"ボイジャー" ―― この一語だけで、私は、もう、思考停止してしまうのです。

"Voyager" -- this one word is enough to make me stop thinking.

■「さよならジュピター」に使われた「VOYAGER~日付のない墓標」

■"VOYAGER - Tombstone without Date" used in "Farewell Jupiter"

1995年の地上波の「ヤシマ作戦」と「MAGIシステム乗っ取り」で止まっていた私の中で、今、何かが動き始めました。

■「秒速5センチメートル」の「コスモナウト」の主人公の邂逅

■A chance encounter with the protagonist of "Cosmonaut" in "5 Centimeters per Second".

"それは本当に、想像も絶するくらい孤独な旅であるはずだ"

"It really must be an unimaginably lonely journey."

"本当の暗闇の中をただひたむきに、一つの水素原子にさえ、めったに出会う事なく、ただただ深淵にあるはずと信じる世界の秘密に近づきたい一心で"

"Just to go on and on through the real darkness, rarely encountering even a single hydrogen atom, just with the single desire to get closer to the secrets of the world that I believe must lie in the abyss."

-----

ネットワークでのリモートホストを行うための"ping"の応答時間は、長くても1秒以内。

The response time for a "ping" to the remote host on the network is less than one second at most.

比して、ボイジャー1号との応答時間は、45時間(162000秒)です。

In comparison, the response time to Voyager 1 is 45 hours (162,000 seconds).

『このチップを修理する手段がなかったことから、同チームはこのチップに保存されていたコードを同システムのメモリーの別の場所に移すことにした。全てのコードを保存できる区画は見つけることができなかったが、コードをセクションに分割して、それぞれ飛行データシステムの別々の場所に保存することに成功した。』

'Since there was no way to repair this chip, the team moved the stored codes to another location in the system's memory. Although they could not find a compartment to store all the codes, they could break them into sections and store each in a separate location in the flight data system.'

―― マジか!

"Really!?"

これは、240億キロの彼方にいる患者の脳の毛細血管のバイパス手術を、目をつむりながら、その状態の一つ一つを45時間ごとに確かめて行うという、想像を絶するオペレーションです。

This operation is unimaginable to bypass the capillaries of a patient's brain, 24 billion kilometers away, with his eyes closed, checking each one of its conditions every 45 hours.

しかも、多分、数ビット/秒通信という中、誤って通信リンクを切断したら、もう永遠にボイジャー1号とは通信ができない、という、最大級のリスクを背負っての、極限の環境下でのオペレーションです。

Moreover, the operation was in an extreme environment with the highest level of risk. If they mistakenly cut the communication link by a few bits per second, the communication with Voyager 1 would be lost forever.

この"もの凄さ"を、どうやったら説明できるだろうか ―― 私には、到底表現しきれない"偉業"で、そして"奇跡"です。

How can I describe the "greatness" of this "feat" and "miracle" that I cannot even begin to describe?

-----

この技術者たちの『もの凄さ』を言語で表現できないので、私は、他の人間に当たり散らすことにします。

Since I can't express in words the 'awesomeness' of these technicians, I'll hit others.

「UFOの呼び方」とかの本を書いている奴、それを信じている奴、実施している奴。

Who writes books like "How to Call UFOs," who believes in them, and who tries them?

お前たちが何を信じているかは、もちろん、お前たちの自由ではある。

What you believe is, of course, up to you.

しかし、「45億キロメートルの彼方の宇宙空間探査」に「応答時間45時間」で、「メモリ上のコード移動」を成し遂げ、そして「再起動」を成し得たエンジニアたちの、気の遠くなるような努力と、その成果に対して、

But for the mind-boggling efforts and accomplishments of the engineers who managed to 'move the code in memory' and 'reboot it' in '45 hours of response time' to 'space exploration 4.5 billion kilometers away', I would like to say a few words,

『お前たちの口から、何か語れることがあるか?』

"What can you tell them about what you do?"

とは、問いたい。

 

2024,江端さんの忘備録

就活面接という名前を借りた、『知財(知的財産権)搾取』があることを、先日、次女から教えられました。

The other day, my second daughter told me that there is "intellectual property (IPR) exploitation" in the name of job interviews.

面接のお題が「次の我が社の新ビジネス」を考えてくる、という内容だそうです。

The subject of the interview was to come up with "the next new business for our company."

このお題は、どの会社も、のたうち苦しみながら、考えて考えて、失敗して、やりなおして、また考えて ―― を、続けている最難関の業務です。

This topic is the most challenging task for any company, as it is a constant struggle, thinking, thinking, failing, redoing, thinking again, and so on.

この最難関の業務を『就活生に考えさせる』というところに、その会社の『いやらしさ』(または、『卑劣』『下劣』『おぞましい』)があります。

The company's "nastiness" (or "meanness," "vileness," or "horror") lies in the fact that it "makes job hunters think" about this most challenging task.

―― これを"知財搾取"と呼ばずに何と呼ぶ?

"What would you call it if you didn't call it "IP exploitation"?"

はっきり言って、私は腹を立てております。

To be clear, I get mad with this company.

『その会社の名前を、ブログで公表したろか』とも思いましたが ―― 次女に類が及んでは意味がありません。

I thought, "Should I publish that company's name on my blog? But it would be meaningless if my second daughter was disadvantaged.

これは、次女の就活が完了した後に、じっくり、ねっとりと、やれば良さそうです。

This issue seems like a good thing to do, slowly and methodically, after the second daughter's job search is complete.

-----

で、まあ、私、次女に頼まれて、そのネタ出しを手伝っていました。

And, well, my second daughter asked me to help her out with the story.

なにしろ、私は、『王禅寺の特許明細書製造装置』ですから。

After all, I am "Ozenji's patent specification manufacturing equipment.

第一ラウンドくらいファイティングポーズを見せないと ―― 『王禅寺の特許明細書製造装置』の名にかけて。

 

2024,江端さんの忘備録

以前、「他の人が忙しいから」と、私に仕事を振ってきた奴がいました。

I once had a guy who gave me a job because "other people were busy."

『死ね、馬鹿野郎』と、私は、今でも腹を立てています。

'Die, you idiot,' I said, still angry.

こんな言い方では、『私が暇そうに見える』と言われているのと同じです。

In this way, it has the same meaning as 'I look bored.

こんな奴の依頼は『拒否』の一択ですが、業務の場合はそれができないこともあります。

The only option for a request from someone like this is to 'refuse,' but that may not be possible in the case of business.

それでも、私が、このような言い方をされたら、私はその人間のことを忘れません ―― 最悪の印象とともに。

Still, I will not forget the guy with the worst possible impression.

この程度の配慮は、年齢を重ねれば、なんとなくできてくるものですが ―― いつまでたっても、それができない人間もいるものです。

This level of consideration comes with age -- but some people can't do it forever.

例えば、「私(江端)」です。

For example, "I (Ebata).

―― プレゼンを見れば、モテるヤツかどうかは、一発で分かる

-----

私は、私の言動(ブログやコラムを含む)で、多くの人を傷つけてきたと思います。

My words and actions have hurt many people (including my blog and columns).

『自分だけは例外』などと思うには、私は、これまで色々なことを『語り過ぎてきた』と思います。

I have "talked too much" about too many things to think I am the exception.

人を傷つけない方法は、

How not to hurt people, are, I think, 

「黙り続けること」「語らないこと」「自分の本心を明らかにしないこと」

To remain silent, not speak, and not reveal one's true feelings.

ぐらいでしょう。

もっとも、これはこれで、かなり難しいです。

However, it is much more difficult to do.

ともあれ『「何かを語る」ということは「誰かを傷付ける」と同義である』ということは、覚えておくべきでしょう。

We should remember that 'talking about something' is synonymous with 'hurting someone.

「いい人」で居続けたいのであれば、黙っていることです。

If you want to remain a "good guy," keep your mouth shut.

ちなみに、上記のフレーズの逆相は、

Incidentally, the reverse phase of the above phrase is,

―― 語れば、必ず「悪い人」になる

"Talking will always make you a "bad person.""

です。

「しゃべれば、ロクな目に合わない」―― これは、もう、人生の帰納的経験則といっても過言ではありません。

-----

ちなみに、上記の「他の人が忙しいから」についてですが、その真偽はどうあれ、この場合に使うべきフレーズは、

By the way, regarding the above "because others are busy," whatever the truth of that, the phrase to use in this case is,

『この件に関しては、江端さんしか頼れる人がいないんです!』

'There is no one else I can turn to but you, Ebata-san, on this matter!

です。

繰り返しますが「真偽はどうあれ」です。

Again, "whatever the truth may be."

2024,江端さんの忘備録

「ロケット 失敗からの再起 技術者たちの348日」を見ました。

I watched "Re-emerging from Rocket Failure: 348 Days of Engineers."

エンジニアたちの真剣な表情に、握りしめたコップが震えました。

The severe expressions on the engineers' faces made my clenched cup tremble.

『プロジェクトX』のような演出なんかなくったって、現場のエンジニアの様子だけで、十分に『心が震えます』。

Even without the production of "Project X," the engineers onsite are enough to "shake their heart.

(7)総じて「プロジェクトX」は、「エンジニアの夢や希望を搾取」して「プロジェクトを完成させた」というストーリで構成されており、現在の若者への「やりがい搾取」と1mmも変わっていないように見える

演出なんかいらない。

I don't need any staging.

音楽もいらない。

I don't even need music.

『プロフェッショナル 仕事の流儀』みたいな、かっこいい台詞も、名言もいらない。

I don't need cool lines or quotes like in "Professional: The Way of Work."

ありのままで、この世界には感動できるものがある、と思います。

As it is, I think something is inspiring in this world.

私、電気工学のマスター(修士)ですので、前回の失敗の原因と考えられていた電気系に関する部分は、大変よく理解できました。

I have a master's in electrical engineering, so I could understand the part about the electrical system that was considered the cause of the previous failure.

そういう内容が含まれていたことも『心が震える』一因になっていたのかもしれません。

The fact that such content may have been one of the reasons for the "shaking of my heart.

-----

規模も期間も全然違いますが、私も、実験の最中に、予想を超える効果が得られて、

The scale and duration are different, but when I also obtained effects that exceeded my expectations during the experiment,

『拳を握りしめて、咆哮を叫びたくなるくらい"嬉しい"』

"It made me want to clench my fists and roar joyfully."

と思える時が ―― 本当に稀ですけど ―― あります。

There are times - rare, really - I feel like the above.

エンジニアには、恋でも、愛でも、金でも、地位でも、権力でもなく、ただ『実験結果が、嬉しい』という時があるのです。

Sometimes, engineers are not in love, money, status, or power but are just 'happy with the experiment's results.

まあ、私には、抱き合ったり、肩を叩き合ったたりして、喜びあう仲間がいませんので、『ヒャッホー』と叫びながら、「部屋の中を駆け足で走り回る」ことしかできません。

However, I don't have any friends to hug or pat each other on the shoulder and rejoice with, so all I can do is "run around the room," shouting, "Hyah-hoo!

残念です。

It's a shame.

それどろか、傍から見ると、私は『怖い人』かもしれません。

I am a scary person from the outside.

-----

以下、コラムから抜粋

The following is an excerpt from the column.

=====

しかし、ようやく10月29日(本当に30分程前に)、EtherCATスレーブでステッピングモーターを回すことに成功しました!

But finally, on October 29 (about 30 minutes ago), I turned a stepper motor with an EtherCAT enslaved person!

嬉しくて、家の中をピョンピョン飛び回っていたのですが、この喜びを共感できる人間が、江端家にはいない。

I was so happy that I was jumping around the house, but no one in the Ebata family could share this joy.

『うん、パパが嬉しいなら、私も嬉しいよ』と、食器を洗う手を止めないで生返事を寄越したのは、

"If you're happy, I'm happy," my lovely wife said, not stopping to wash the dishes, whose aphorisms is 

―― リトマス試験紙が、青になろうが赤になろうが、それが一体何だというの?

" What does it matter if the litmus test paper turns blue or red?"

という名言を残した、私の最愛の妻です。

=====

2024,江端さんの技術メモ

なんでもかんでも、ニューラルネットワークに突っ込む必要はないと思うんですよね。

/*
	c:\users\ebata\tomioka3b\src\others\main41.go

	このプログラムは、与えられた地点の緯度経度情報と京急富岡駅からの電車による移動時間を元に、スプライン補間を行い、特定の座標における移動時間を補間することを目的としています。

	Point 構造体は、地点の名前 (Name)、緯度 (Latitude)、経度 (Longitude)、移動時間 (min2Tomioka) の情報を保持します。
	convertToDataSet 関数は、Point 構造体の配列を受け取り、それを緯度、経度、標高の情報を含む二次元配列データセットに変換します。
	splineInterpolation 関数は、スプライン補間を行うための関数を返します。この関数は、与えられたデータセットを元に、スプライン補間に必要な計算を行います。
	main 関数では、与えられた地点の情報を元に Point 構造体のスライスが定義され、それを convertToDataSet 関数で二次元配列データセットに変換します。
	さらに、splineInterpolation 関数を使用してスプライン補間関数を生成し、特定の座標における移動時間を補間します。
	最後に、補間された値が出力されます。
	このプログラムは、地理空間データの補間処理に利用できる汎用的なスプライン補間関数を提供します。
*/

package main

import (
	"fmt"
	"sort"
)

type Point struct {
	Name        string
	Latitude    float64
	Longitude   float64
	min2Tomioka float64
}

// スプライン補間用の関数
func splineInterpolation(dataSet [][]float64) func(float64, float64) float64 {
	n := len(dataSet)

	// xの値を昇順にソートする
	sort.Slice(dataSet, func(i, j int) bool {
		return dataSet[i][0] < dataSet[j][0]
	})

	// トリディアゴナル行列を作成
	h := make([]float64, n-1)
	for i := 0; i < n-1; i++ {
		h[i] = dataSet[i+1][0] - dataSet[i][0]
	}

	// 2階微分の値を計算
	delta := make([]float64, n)
	for i := 1; i < n-1; i++ {
		delta[i] = (dataSet[i+1][1]-dataSet[i][1])/h[i] - (dataSet[i][1]-dataSet[i-1][1])/h[i-1]
	}

	// トリディアゴナル行列を解く
	m := make([]float64, n)
	l := make([]float64, n)
	zArray := make([]float64, n)
	l[0] = 1
	for i := 1; i < n-1; i++ {
		l[i] = 2*(dataSet[i+1][0]-dataSet[i-1][0]) - h[i-1]*m[i-1]
		m[i] = h[i] / l[i]
		zArray[i] = (delta[i] - h[i-1]*zArray[i-1]) / l[i]
	}
	l[n-1] = 1
	zArray[n-1] = 0

	c := make([]float64, n)
	b := make([]float64, n)
	d := make([]float64, n)
	for j := n - 2; j >= 0; j-- {
		c[j] = zArray[j] - m[j]*c[j+1]
		b[j] = (dataSet[j+1][1]-dataSet[j][1])/h[j] - h[j]*(c[j+1]+2*c[j])/3
		d[j] = (c[j+1] - c[j]) / (3 * h[j])
	}

	// 補間関数を返す
	return func(xVal, yVal float64) float64 {
		// xの範囲を確認
		if xVal < dataSet[0][0] || xVal > dataSet[n-1][0] {
			panic("x value is out of range")
		}

		// 対応するiを探す
		i := 0
		for i < n-1 && dataSet[i+1][0] <= xVal {
			i++
		}

		// スプライン補間を計算
		dx := xVal - dataSet[i][0]
		return dataSet[i][2] + b[i]*dx + c[i]*dx*dx + d[i]*dx*dx*dx
	}
}

func convertToDataSet(points []Point) [][]float64 {
	var dataSet [][]float64

	for _, point := range points {
		data := []float64{point.Latitude, point.Longitude, point.min2Tomioka}
		dataSet = append(dataSet, data)
	}

	return dataSet
}

func main() {
	points := []Point{
		{"日暮里", 35.72810551475649, 139.77065214505967, 73},   // 日暮里
		{"鶯谷", 35.72147285483459, 139.77803484630024, 63},    // 鶯谷
		{"上野", 35.71419330617392, 139.7774413019538, 57},     // 上野
		{"御徒町", 35.70752513412557, 139.7748544863164, 67},    // 御徒町
		{"秋葉原", 35.6983999333567, 139.77290571388025, 65},    // 秋葉原
		{"お茶の水", 35.69977763102643, 139.76447338219248, 61},  // お茶の水
		{"水道橋", 35.7020483726974, 139.75337286940393, 66},    // 水道橋
		{"神田", 35.691843953947895, 139.77075286750426, 63},   // 神田
		{"東京", 35.68127103173912, 139.76691023873528, 57},    // 東京
		{"有楽町", 35.67504451109795, 139.7629009441794, 59},    // 有楽町
		{"新橋", 35.6663876890884, 139.7580715945385, 55},      // 新橋
		{"浜松町", 35.65538959029243, 139.75707527127187, 54},   // 浜松町
		{"田町", 35.64573607270807, 139.7475731442898, 54},     // 田町
		{"品川", 35.628479993237924, 139.73869534241823, 43},   // 品川
		{"北品川", 35.62204337901307, 139.73929378869565, 50},   // 北品川
		{"青物横丁", 35.616530476669595, 139.74147241132803, 49}, // 新馬場
		{"青物横丁", 35.6089113073848, 139.74314516357873, 45},   // 青物横丁
		{"鮫洲", 35.60505014227371, 139.74226998316405, 50},    // 鮫洲
		{"立会川", 35.598565208786674, 139.73893538884946, 50},  // 立会川
		{"大森海岸", 35.58770513004266, 139.73546417819148, 51},  // 大森海岸
		{"平和島", 35.578786612348516, 139.7348957122944, 40},   // 平和島
		{"大森町", 35.572470928220454, 139.73209389290315, 53},  // 大森町
		{"梅屋敷", 35.56680589146817, 139.7282405712228, 53},    // 梅屋敷
		{"京急蒲田", 35.561346378009084, 139.72413782845052, 33}, // 京急蒲田

		{"雑色", 35.549501628543595, 139.71492252305998, 38},   // 雑色
		{"六郷土手", 35.540534565682265, 139.70758227692838, 34}, // 六郷土手

		{"糀谷", 35.55475500818507, 139.72947450479222, 40},   // 糀谷
		{"大鳥居", 35.55230710920823, 139.74016209480337, 45},  // 大鳥居
		{"穴守稲荷", 35.550433498630504, 139.7467475129522, 46}, // 穴守稲荷

		{"天空橋", 35.549323611239814, 139.75367380680967, 46},    // 天空橋
		{"京急川崎", 35.5330130222155, 139.70085261643172, 30},     // 京急川崎
		{"小島新田", 35.53497952289224, 139.74753015189842, 42},    // 小島新田
		{"八丁畷", 35.523294588264044, 139.69182471487903, 41},    // 八丁畷
		{"鶴見市場", 35.51795110131048, 139.68654897642313, 40},    // 鶴見市場
		{"京急鶴見", 35.507313116366205, 139.67793452856546, 34},   // 京急鶴見
		{"花月総持寺", 35.50045335293103, 139.67299835084395, 31},   // 花月総持寺
		{"生麦", 35.49532037586162, 139.66697084291033, 30},      // 生麦
		{"京急新子安", 35.48709301222138, 139.6554644900453, 29},    // 京急新子安
		{"子安", 35.484595747125226, 139.64499414507037, 32},     // 子安
		{"神奈川新町", 35.48089584236831, 139.63961808116608, 26},   // 神奈川新町
		{"京急東神奈川", 35.47728484644749, 139.63437152522133, 30},  // 京急東神奈川
		{"神奈川", 35.471042823081326, 139.62708525622278, 32},    // 神奈川
		{"京急横浜", 35.465974566273886, 139.6218737093478, 20},    // 京急横浜
		{"戸部", 35.45669353999209, 139.61954391949988, 27},      // 戸部
		{"日ノ出町", 35.445535830399635, 139.62677764713118, 25},   // 日ノ出町
		{"黄金町", 35.4398051861557, 139.6228192707623, 24},       // 黄金町
		{"南太田", 35.43704871593425, 139.61413963595152, 18},     // 南太田
		{"井土ヶ谷", 35.434049908914936, 139.6013697675809, 16},    // 井土ヶ谷
		{"弘明寺", 35.424392517088215, 139.59679056178064, 17},    // 弘明寺
		{"上大岡", 35.409119230795824, 139.59658257505384, 14},    // 上大岡
		{"屏風浦", 35.394628914972444, 139.61025512796533, 10},    // 屏風浦
		{"杉田", 35.38359625400674, 139.6158614781421, 3},        // 杉田
		{"京急富岡", 35.36713079862617, 139.6298755067998, 0},      // 京急富岡
		{"能見台", 35.36088096572114, 139.62943901110575, 1},      // 能見台
		{"京急金沢文庫", 35.34283976967888, 139.62161382892742, 3},   // 京急金沢文庫
		{"金沢八景", 35.33143644664979, 139.62019186432977, 6},     // 金沢八景
		{"野島公園", 35.33057520638215, 139.63154448609114, 17},    // 野島公園
		{"海の公園南口", 35.337221851530074, 139.63203843792144, 18}, // 海の公園南口
		{"海の公園芝口", 35.34207978297347, 139.6357948657779, 18},   // 海の公園芝口
		{"八景島", 35.34081263381398, 139.64082413734104, 20},     // 八景島
		{"六浦", 35.32276335943298, 139.61123194142903, 13},      // 六浦
		{"神武寺", 35.306362422782364, 139.59316695868543, 19},    // 神武寺
		{"逗子・葉山", 35.29593435944306, 139.5811992373588, 31},    // 逗子・葉山
		{"追浜", 35.3158514243523, 139.62481670534095, 15},       // 追浜
		{"京急田浦", 35.30091271311823, 139.62553483073157, 16},    // 京急田浦
		{"安針塚", 35.28681218160922, 139.64296751736376, 17},     // 安針塚
		{"逸見", 35.28064334099864, 139.6528184088048, 21},       // 逸見
		{"汐入", 35.280307747849356, 139.6624959442711, 19},      // 汐入
		{"横須賀中央", 35.27868971431925, 139.6700294865965, 20},    // 横須賀中央
		{"県立大学", 35.27046934794596, 139.6765472421848, 26},     // 県立大学
		{"堀ノ内", 35.263578813428, 139.68674190193195, 23},       // 堀ノ内
		{"新大津", 35.25692239324099, 139.69014415109714, 23},     // 新大津
		{"北久里浜", 35.2497686048071, 139.68628696286345, 25},     // 北久里浜
		{"浦賀", 35.250938172839675, 139.71498764424754, 30},     // 浦賀
		{"京急久里浜", 35.231585086558596, 139.7022284815838, 29},   // 京急久里浜
		{"YRP野比", 35.21207247285571, 139.68500815775707, 33},   // YRP野比
		{"京急長沢", 35.20555570645748, 139.67414472893097, 44},    // 京急長沢
		{"津久井浜", 35.19868000571067, 139.66570472891374, 37},    // 津久井浜
		{"三浦海岸", 35.188117336673066, 139.65328211521543, 39},   // 三浦海岸
		{"三崎口", 35.17752001890131, 139.633171976671, 42},       // 三崎口
	}

	dataSet := convertToDataSet(points)

	// スプライン補間関数を作成
	interpolatedFunction := splineInterpolation(dataSet)

	// 特定の座標で補間された値を計算
	xValue := 35.4688634
	yValue := 139.6268306

	xValue, yValue = 35.7214573, 139.7754384

	interpolatedValue := interpolatedFunction(xValue, yValue)

	// 結果の出力
	fmt.Printf("補間された値: %.2f\n", interpolatedValue)
}

 

2024,江端さんの技術メモ

//	c:\users\ebata\tomioka3b\src\others\main45.go

/*
	このプログラムは、与えられた複数の地点の中からランダムに1つを選択し、その地点を中心として半径500メートルの円内にランダムな地点を生成します。

	Point 構造体: 緯度と経度を表す構造体です。
	main 関数:
	与えられた複数の地点のリストを作成します。
	ランダムに1つの地点を選択します。
	選択された地点を中心として、generateRandomPointInCircle 関数を使用して半径500メートルの円内にランダムな地点を生成します。
	生成されたランダムな地点の緯度と経度を出力します。
	generateRandomPointInCircle 関数:
	中心となる地点と半径を受け取ります。
	ランダムな角度と距離を生成し、それらを使用して円内のランダムな地点の緯度と経度を計算します。
	計算された緯度と経度を持つ地点を返します。
	degToRad 関数:
	度をラジアンに変換するためのユーティリティ関数です。
	このプログラムは、与えられた地点の中からランダムに1つを選択し、その地点を中心として半径500メートルの円内にランダムな地点を生成することで、地理空間データを扱うための基本的な方法を示しています。
*/

package main

import (
	"fmt"
	"math"
	"math/rand"
	"time"
)

type Point struct {
	Name        string
	Latitude    float64
	Longitude   float64
	min2Tomioka float64
}

func main() {
	// 与えられた複数の点(駅の座標)
	points := []Point{
		{"日暮里", 35.72810551475649, 139.77065214505967, 73},   // 日暮里
		{"鶯谷", 35.72147285483459, 139.77803484630024, 63},    // 鶯谷
		{"上野", 35.71419330617392, 139.7774413019538, 57},     // 上野
		{"御徒町", 35.70752513412557, 139.7748544863164, 67},    // 御徒町
		{"秋葉原", 35.6983999333567, 139.77290571388025, 65},    // 秋葉原
		{"お茶の水", 35.69977763102643, 139.76447338219248, 61},  // お茶の水
		{"水道橋", 35.7020483726974, 139.75337286940393, 66},    // 水道橋
		{"神田", 35.691843953947895, 139.77075286750426, 63},   // 神田
		{"東京", 35.68127103173912, 139.76691023873528, 57},    // 東京
		{"有楽町", 35.67504451109795, 139.7629009441794, 59},    // 有楽町
		{"新橋", 35.6663876890884, 139.7580715945385, 55},      // 新橋
		{"浜松町", 35.65538959029243, 139.75707527127187, 54},   // 浜松町
		{"田町", 35.64573607270807, 139.7475731442898, 54},     // 田町
		{"品川", 35.628479993237924, 139.73869534241823, 43},   // 品川
		{"北品川", 35.62204337901307, 139.73929378869565, 50},   // 北品川
		{"青物横丁", 35.616530476669595, 139.74147241132803, 49}, // 新馬場
		{"青物横丁", 35.6089113073848, 139.74314516357873, 45},   // 青物横丁
		{"鮫洲", 35.60505014227371, 139.74226998316405, 50},    // 鮫洲
		{"立会川", 35.598565208786674, 139.73893538884946, 50},  // 立会川
		{"大森海岸", 35.58770513004266, 139.73546417819148, 51},  // 大森海岸
		{"平和島", 35.578786612348516, 139.7348957122944, 40},   // 平和島
		{"大森町", 35.572470928220454, 139.73209389290315, 53},  // 大森町
		{"梅屋敷", 35.56680589146817, 139.7282405712228, 53},    // 梅屋敷
		{"京急蒲田", 35.561346378009084, 139.72413782845052, 33}, // 京急蒲田

		{"雑色", 35.549501628543595, 139.71492252305998, 38},   // 雑色
		{"六郷土手", 35.540534565682265, 139.70758227692838, 34}, // 六郷土手

		{"糀谷", 35.55475500818507, 139.72947450479222, 40},   // 糀谷
		{"大鳥居", 35.55230710920823, 139.74016209480337, 45},  // 大鳥居
		{"穴守稲荷", 35.550433498630504, 139.7467475129522, 46}, // 穴守稲荷

		{"天空橋", 35.549323611239814, 139.75367380680967, 46},    // 天空橋
		{"京急川崎", 35.5330130222155, 139.70085261643172, 30},     // 京急川崎
		{"小島新田", 35.53497952289224, 139.74753015189842, 42},    // 小島新田
		{"八丁畷", 35.523294588264044, 139.69182471487903, 41},    // 八丁畷
		{"鶴見市場", 35.51795110131048, 139.68654897642313, 40},    // 鶴見市場
		{"京急鶴見", 35.507313116366205, 139.67793452856546, 34},   // 京急鶴見
		{"花月総持寺", 35.50045335293103, 139.67299835084395, 31},   // 花月総持寺
		{"生麦", 35.49532037586162, 139.66697084291033, 30},      // 生麦
		{"京急新子安", 35.48709301222138, 139.6554644900453, 29},    // 京急新子安
		{"子安", 35.484595747125226, 139.64499414507037, 32},     // 子安
		{"神奈川新町", 35.48089584236831, 139.63961808116608, 26},   // 神奈川新町
		{"京急東神奈川", 35.47728484644749, 139.63437152522133, 30},  // 京急東神奈川
		{"神奈川", 35.471042823081326, 139.62708525622278, 32},    // 神奈川
		{"京急横浜", 35.465974566273886, 139.6218737093478, 20},    // 京急横浜
		{"戸部", 35.45669353999209, 139.61954391949988, 27},      // 戸部
		{"日ノ出町", 35.445535830399635, 139.62677764713118, 25},   // 日ノ出町
		{"黄金町", 35.4398051861557, 139.6228192707623, 24},       // 黄金町
		{"南太田", 35.43704871593425, 139.61413963595152, 18},     // 南太田
		{"井土ヶ谷", 35.434049908914936, 139.6013697675809, 16},    // 井土ヶ谷
		{"弘明寺", 35.424392517088215, 139.59679056178064, 17},    // 弘明寺
		{"上大岡", 35.409119230795824, 139.59658257505384, 14},    // 上大岡
		{"屏風浦", 35.394628914972444, 139.61025512796533, 10},    // 屏風浦
		{"杉田", 35.38359625400674, 139.6158614781421, 3},        // 杉田
		{"京急富岡", 35.36713079862617, 139.6298755067998, 0},      // 京急富岡
		{"能見台", 35.36088096572114, 139.62943901110575, 1},      // 能見台
		{"京急金沢文庫", 35.34283976967888, 139.62161382892742, 3},   // 京急金沢文庫
		{"金沢八景", 35.33143644664979, 139.62019186432977, 6},     // 金沢八景
		{"野島公園", 35.33057520638215, 139.63154448609114, 17},    // 野島公園
		{"海の公園南口", 35.337221851530074, 139.63203843792144, 18}, // 海の公園南口
		{"海の公園芝口", 35.34207978297347, 139.6357948657779, 18},   // 海の公園芝口
		{"八景島", 35.34081263381398, 139.64082413734104, 20},     // 八景島
		{"六浦", 35.32276335943298, 139.61123194142903, 13},      // 六浦
		{"神武寺", 35.306362422782364, 139.59316695868543, 19},    // 神武寺
		{"逗子・葉山", 35.29593435944306, 139.5811992373588, 31},    // 逗子・葉山
		{"追浜", 35.3158514243523, 139.62481670534095, 15},       // 追浜
		{"京急田浦", 35.30091271311823, 139.62553483073157, 16},    // 京急田浦
		{"安針塚", 35.28681218160922, 139.64296751736376, 17},     // 安針塚
		{"逸見", 35.28064334099864, 139.6528184088048, 21},       // 逸見
		{"汐入", 35.280307747849356, 139.6624959442711, 19},      // 汐入
		{"横須賀中央", 35.27868971431925, 139.6700294865965, 20},    // 横須賀中央
		{"県立大学", 35.27046934794596, 139.6765472421848, 26},     // 県立大学
		{"堀ノ内", 35.263578813428, 139.68674190193195, 23},       // 堀ノ内
		{"新大津", 35.25692239324099, 139.69014415109714, 23},     // 新大津
		{"北久里浜", 35.2497686048071, 139.68628696286345, 25},     // 北久里浜
		{"浦賀", 35.250938172839675, 139.71498764424754, 30},     // 浦賀
		{"京急久里浜", 35.231585086558596, 139.7022284815838, 29},   // 京急久里浜
		{"YRP野比", 35.21207247285571, 139.68500815775707, 33},   // YRP野比
		{"京急長沢", 35.20555570645748, 139.67414472893097, 44},    // 京急長沢
		{"津久井浜", 35.19868000571067, 139.66570472891374, 37},    // 津久井浜
		{"三浦海岸", 35.188117336673066, 139.65328211521543, 39},   // 三浦海岸
		{"三崎口", 35.17752001890131, 139.633171976671, 42},       // 三崎口
	}

	// ランダムな点を選択
	rand.Seed(time.Now().UnixNano())

	for i := 0; i < 1000; i++ {

		randomIndex := rand.Intn(len(points))
		center := points[randomIndex]

		// 中心点から半径500メートルの円内にランダムな点を生成
		randomPoint := generateRandomPointInCircle(center, 500)

		//fmt.Printf("Random Point in Circle: Latitude=%f, Longitude=%f\n", randomPoint.Latitude, randomPoint.Longitude)
		fmt.Printf("%f, %f\n", randomPoint.Latitude, randomPoint.Longitude)
	}

}

func generateRandomPointInCircle(center Point, radius float64) Point {
	// ランダムな角度を生成
	randAngle := rand.Float64() * 2 * math.Pi
	//fmt.Printf("randAngle=%f\n", randAngle)

	// ランダムな距離を生成
	randDistance := math.Sqrt(rand.Float64()) * radius
	//fmt.Printf("randDistance=%f\n", randDistance)

	// ランダムな点の座標を計算

	randLat := center.Latitude + (randDistance/6371000.0)*(180/math.Pi)*(math.Cos(randAngle))
	randLon := center.Longitude + (randDistance/6371000.0)*(180/math.Pi)*(math.Sin(randAngle))/(math.Cos(degToRad(center.Latitude)))

	return Point{Latitude: randLat, Longitude: randLon}
}

func degToRad(deg float64) float64 {
	return deg * (math.Pi / 180)
}