mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
commit
ce47c42b15
2 changed files with 15 additions and 10 deletions
|
@ -6496,20 +6496,22 @@ class ThumbnailP2(ThumbnailP1):
|
|||
|
||||
class ThumbnailOverlay(Scene):
|
||||
def construct(self):
|
||||
title = TextMobject("Quaternions")
|
||||
title.set_width(8)
|
||||
title.to_edge(UP)
|
||||
title = TextMobject("Quaternions \\\\", "visualized")
|
||||
title.set_width(7)
|
||||
# title[1].scale(0.7, about_edge=UP)
|
||||
title.to_edge(UP, buff=MED_SMALL_BUFF)
|
||||
v_line = Line(DOWN, UP)
|
||||
v_line.set_height(FRAME_HEIGHT)
|
||||
|
||||
title.set_background_stroke(color=BLACK, width=1)
|
||||
|
||||
rect = BackgroundRectangle(title[4:6])
|
||||
rect.set_fill(opacity=1)
|
||||
rect.stretch(0.9, 0)
|
||||
rect.stretch(1.1, 1)
|
||||
title.add_to_back(BackgroundRectangle(title[0]))
|
||||
title.add_to_back(rect)
|
||||
for part in (title[0][4:6], title[1][4:5]):
|
||||
rect = BackgroundRectangle(part)
|
||||
rect.set_fill(opacity=1)
|
||||
rect.stretch(0.9, 0)
|
||||
rect.stretch(1.1, 1)
|
||||
title.add_to_back(rect)
|
||||
# title.add_to_back(BackgroundRectangle(title[0]))
|
||||
|
||||
arrow = Arrow(LEFT, RIGHT)
|
||||
arrow.scale(1.5)
|
||||
|
|
|
@ -43,7 +43,10 @@ def quaternion_conjugate(quaternion):
|
|||
def rotate_vector(vector, angle, axis=OUT):
|
||||
quat = quaternion_from_angle_axis(angle, axis)
|
||||
quat_inv = quaternion_conjugate(quat)
|
||||
product = reduce(quaternion_mult, [quat, np.append(0, vector), quat_inv])
|
||||
product = reduce(
|
||||
quaternion_mult,
|
||||
[quat, np.append(0, vector), quat_inv]
|
||||
)
|
||||
return product[1:]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue