## Monday, 30 March 2020

### Calculating area enclosed by intersections

A small math question today.

Given a unit sphere and an arbitrary ellipsoid, calculate the surface area of sphere inside the ellipsoid.

Without loss of generality, we may assume the unit sphere to be centered at origin, then the question depends solely on the 6 parameters defining the ellipsoid, $c_i, \alpha_i$ for $i=1,2,3$ in $\sum (x_i-c_i)^2/\alpha _i ^2 = 1$. Without thinking too much about existence of analytic solution in terms of the parameters, we want to look for ways to calculate or at least approximate the problem.

My own solution is based on the famous Gauss-Bonnet theorem:
$\int _M KdA + \int _{\partial M} \kappa _g ds = 2\pi \chi (M)$

The curvature of a unit sphere is constantly 1, and the Euler characteristic of a disc is 1. As long as you can calculate the geodesic curvature you get
$|M| = 2\pi - \int _{\partial M} \kappa _g ds$.
The intersection is a union of finitely many closed curves we can just calculate one by one.

A simple example would be as follows:

Consider the intersection between $x^2+y^2+z^2=1$ and $(x-1)^2+y^2+z^2=1$. The intersection $\Gamma$ is given by $x = \frac{1}{2}$ and $y^2+z^2 = \frac{3}{4}$. This is a circle of radius $\frac{\sqrt{3}}{2}$ with geodesic curvature $\frac{1}{\sqrt{3}}$. Therefore we have $\int _{\Gamma} \kappa _g ds = \pi$, so $|A| = 2\pi \pm \pi$ depending on the orientation. The surface area can be verified using the formula from Archimedes $|A| = \pi (h^2+a^2)$.

*

Of course, obtaining the parametrization is sometimes too difficult. Are there any easier ways to approximate the answer? Here are two suggestions from my friends.

- Monte Carlo based: sample points on the surface of the sphere and check whether it is in the ellipsoid.

- Integral approximation: similar to Monte Carlo but instead we split the sphere into pieces using spherical coordinates, then the required area is the integral over the indicator function of the ellipsoid.

And of course we can get an estimation using the Gauss-Bonnet approach. Let us call the sphere $S$ and the ellipsoid $E$. We start from a point of intersection, say $x$. The curve goes in the direction $v\in T_xS \cap T_xE$, the intersection of the tangent spaces of the two objects at $x$. We know the intersection must be of dimension 1 because if the two objects are cotangent at the point then the intersection is a point which generates no area after all.

Obtaining this direction is simply algebra, where we find the intersection between two subspace. With this direction we can numerically obtain a closed curve. There is a gap here because we may not go back to the starting point using numerical approximation. We just assume by smoothness (well sphere and ellipsoid are very nice objects) by doing fine enough approximation things would work (actually I believe we can prove this but I am not an expert in numerical methods) -- then we have an approximated curve of intersection.

From here we can calculate its length as well as its geodesic curvature, and the estimated area follows.

Gauss-Bonnet seems quite universal even if we generalize sphere and ellipsoid to other bounded closed $C^{\infty}$ objects because they are manifolds anyway. The only worry being whether we can get a closed curve without any global features that promises convergence.

*

Well this is just a funny little problem that I enjoyed during the lockdown. I feel like I should write some maths before I go back to my creation whether it is literature, music or research.

Meanwhile I hope everyone is alright during the pandemic -- whether you call it COVID-19, or Wuhan virus. Stay indoor, and stay healthy.

## Monday, 9 March 2020

### ⑨/3/2020 Cirno's ⑨th Anniversary

YuFu - Holy Moon是自己進入太鼓界的鑰匙，做出自己最高水準似乎理所當然。

IIDX的Babylonia是自己熟識的民族風，加上自己在風雪中偶然得到靈感，做出佳作也是順理成章。

Cirno's Perfect Math Class [Wmf's Taiko]

Cirno's Perfect Maths Class: The 9th Anniversary Edition [Wmf's 2011 Taiko]

## Sunday, 16 February 2020

### On three houses (3): Cindered Shadows

DLC 4 is the last scheduled expansion of Three Houses and is also the largest expansion. A completely new side story alongside with new characters, quests and activities that provides further clues about the main story.

Having new characters and activities means you need to play side story plus a complete rundown in the main story to experience everything -- which is too much for a player who have already completed the game 5 times. Below are my thoughts after completing the side story with a taste of main story with the presence of the new contents.

Part I: on game mechanics

Side story

Did it in hard classic and it does not disappoint me. Enemies have config slightly above the "main story" hard, but with limited resources (though not "lacking resources") and being inaccessible to auxiliary battles it could be pretty hard. The way the game works here is pretty close to that in classic Fire Emblem (like Blazing Blade), so as the difficulty.

The side story consists of 6 unique battles. Enemies are compactly packed that does not allow the slightest bit of excessive training.

I personally like the third battle the most -- the two possible routes gives flexibility on how you can play the stage. Actually I figured that it is the safest to use both of them.

The final boss is also interesting given its gimmicky special attack. I found however, the fight would still be possible without the post-AOE weakening. That would be a lot more interesting as well as pushing the difficulty up to the maddening bar.

Story-wise, there is not a lot that you can do in a 7 chapter span where the second half are all about consecutive battles. Someone data-mined that there will be 13 chapters and a more detailed stories can be delivered in such length.

With the introduction of Abyss, I expect them to focus on interaction among underground students and residents because those residents are reasons the student were there. But with 7 chapters only IS did enough to introduce the students. The interactions are left for support conversations, which are also nicely written.

New classes

Yes that is a great solution to what I pointed out before. The new classes aimed to provide full flexibility between magic accessibility and melee potential of the characters.

Dark fliers is the long awaited class, fliers that can use magic. Even with sacrificed growth the class completely worth it given how overpowered fliers can be in the game.

Valkyries seem to clash with holy/dark knight at the master class, but it bridges well between the mage class and the magic knight classes since the lance requirement is gone. It's range+1 also allows long range magic snipers other than Lorenz.

Tricksters and war monks are adjustments to melee-magical units without the problem of mortal servants where growth were split 50/50 that doesn't really work on characters that fit. These two classes are primarily for melee based (trickster for dex based and war monk for vit/def based) characters who also wants to use heal at times.

Trickster is also a bridge between sword users and mortal servants, if one trains reason and faith simultaneously. However this is really a class taylor made for Yuri with his growth distribution especially with his unique combat art, the foul play. In side story I would made him MVP as he and Edelgard combined are capable to take all physical attacks. And while Edelgard slashes back for 35 damage, Yuri simply goes for 15+45 critical...

In side story, the two magical units are very fragile due to its limited movement (compared to master classes), the abundance of stairs (for valkyries) and team composition that couldn't protect them well. The war monk is kind of balanced -- he can sweep but you do not want to put him up front too often. Yuri of course survives anywhere on the map.

If we are to use these classes in the main story with proper team setup, it is expected that dark fliers will be used as a final form. Valkyrie might be a bridge to magic knight but it may also be used as a final form if one wants to do long range snips. Trickster is probably reserved for Yuri or at most Felix. War monk...is still awkward for me.

New region and activities

That I do not have full experience of. But new area's new area. They fill the area with new NPCs and new dialogues that consolidates the story further and this is never a bad thing.

Scraps may be useful for maddening or players who really lack resources. Altar is useful for New Game+ players who wants to get specific item where they didn't get because they skipped some game elements, and that's also good.

The idea of mysterious teacher is nice although I still haven't got a full picture on how it works, but it looks interesting. And for the rest, I am probably won't have the time to explore since it will take me another 15-20 hours to go through the game again...

4 new well-crafted characters and they fit well in Abyss.

Hapi the anti-social who disbeliefs the church. Constance a fallen noble with Schizophrenia. Balthus the bold, the gambler and the alcoholic. Though nothing too surprising you have got to say these settings do work.

And of course Yuri. As a house leader (kind of) he completes the weapon cycle among the leaders, and he also completes the personality quadrants among them. He is charismatic but disbeliefs in the church unlike Claude. His charm and wise fits with his trickster class, but what surrounds him does not give him free will after all. He is the classic Japanese RPG protagonist, and a fitting last piece to this Fire Emblem sequel.

I wish that the support between Yuri and Byleth(s) could have been more romantic -- Yuri can flirt Ingrid without backfiring (just look at Sylvain), but he seems to be so clueless against us...

Conclusion

So, what should I grade Fire Emblem Three Houses for now?

School system that attracts everyone except hardcore classic players. New class system that is pretty much complete upon DLC. Multiple difficulties that can be completed with or without extra battles. Up to 40 characters with thousands of support conversations.

...all in one game. This is Fire Emblem Three Houses.

I would give 7.8/10 after writing (1). But with DLC the game probably worths a score of 8.5/10. A masterpiece that is for everybody, whether you are hardcore SRPG player or not.

## Tuesday, 11 February 2020

### 夢．十夜 (X4) Encore

2019年12月30日，國際展示場。

*

28日下午、青海橋上。

「所以我的檔口就拜托你了～」
「大姐這可是三日目啊……我留在這邊一整天是要怎樣出去拼殺？」
「給我一個購物清單，我找ACGN的人幫你搶總可以吧？」
「來コミケ的重點就是要閑逛尋找自己不認識的繪師作家啊……留點時間給我總可以了吧？」看她金光閃亮的雙眼就猜到她今天另有打算。
「唔……三點我找人來代班吧。」
「三點的話大部份的攤檔都走了好嗎！一點吧？」
「兩點半。」「一點半。」
「兩點。」「嘛……兩點就兩點吧。」反正我也不是瞄準大手作品，人少點也比較方便。
「不過我有個額外條件。」「嗯？」

「我想泡溫泉。」少女轉身向著我稍稍彎腰，寬鬆的外套沿重力垂下，露出裡面的高分少女(ハイスコアガール)T恤。

「長……長野。」是旅行。

「唔……長野山田溫泉藤井莊三日兩夜如何？」網上的評分是9.5/10分，總不會是個雷吧。

「先給你六十分，剩下的要到當地再看你的表現吧。」她露出得逞的笑容：「喔對了，請cos成樹君幫我顧檔吧。」

「你是出火紋英雄相關的本，幻影異聞錄還沒登陸在那邊吧？」

「都是火紋就別分太細了啦，當是swtich版發售前應援也好。而且火紋裡適合你的男角也沒多少個吧，要不狼師(ベレト)和樹君讓你二選一好了？我覺得你跟狼師那種無口搭不上啦。」

*

「嗨～讓你久等了～」依舊元氣的聲音從遠處傳來，不過似乎大家都在埋頭看本而沒有理會這聲音的主人。

「織部つばさ、17歳です！」

「的確是很可愛，跟我這套一起訂造的嗎？」

「沒有呢，這種JK服太常見了。我只是拿舊cos服循環再用一下啦。對了，你要的本本我都幫你買了喔。」她從旁邊接過紙袋，棕色的紙袋上是叼著花朵的白髮少女，旁邊寫有white parabellum的字樣，毫無疑問就是白髮教副教主凪白みと的作品。隨著教主三嶋くろね與副教主凪白みと人氣水漲船高，更多繪師也投入了量產白髮少女的行列。在新晉白髮教徒之中偏向成熟風格的ふーろ應該會成為明日之星吧。

「想買的東西都在袋裡啦，你沒看到袋子都穿了一角了嗎？」她有點吃力地把袋子舉起來。底部的確有個角破了，露出裡面滿滿的本子。不過我能斷定那個破洞是人太多把袋擦傷造成的才對。

「……唔！」她的眼神動搖了一下。

「ゆきさめ的武器娘本呢……刀彼方這次的新刊也不錯呢，他的機甲越來越有Gia的味道了。」「甚麼……！」

「偶像大師那邊有看過嗎？雖然你對R18本沒興趣，不過聽說白瀨終於有正常向本子了……」

「現在不是還有一點時間嘛～我帶你極速走一圈好了。上面所有提過攤位的位置，我都記住了喔。」

「真……真的？」現在的她完全失去平常的氣勢，像兔子般眼巴巴的望著我。

「你看我有騙過你嗎？」我從自己攤位的後方抽出一把長傘：「要看的話現在就要趕快去囉，再晚一點就真的甚麼都沒有了。」傘柄被修改成劍柄的樣子，看上去就像把佩劍抽出來一樣。長傘旁邊才真是蒼井樹的劍，不過遊戲裡劍都是憑空抽出來的，我身上根本沒有掛劍的地方，劍便只好這樣放一邊了。

*

## Thursday, 23 January 2020

### 拉麵食記2020：拉博、燈花、Due Italian

Ryu's noodle bar

800圓的清湯鯛鹽拉麵質素遠超我的想象。清澈的湯底可以嚐出鯛魚的鮮味，隱晦的魚湯唯有鹽味才有辦法配合。正因為湯底極淡，每一種配料的味道都清晰的呈現了出來。半肥瘦的叉燒沒有太多醃製但單純的油脂味與湯底相當配合；超長的新鮮竹荀除了口感一流外亦為清湯增添鮮味；柚子配鹽味湯底算常見組合，雖然偏苦但配上清湯反而效果不錯；糖心蛋偏熟是唯一扣分的地方。平時很少將湯喝完的我居然也把湯喝光了，足見鯛鹽湯底之清。

Due Italian

*