LaTex
latex를 render하려면 코드를 삽입.
MathJax.Hub.Queue(["Typeset",MathJax.Hub])
모든 latex backslash는 이중 backslash (ex. \\ )로 대체해야 한다.
모든 latex 문은 \\(<latex here> \\) 또는 $ <latex here> $ 또는 $ $ <latex here> $로 묶어야 하며, 여기서 $$는 방정식을 새로운 선으로 이동시킨다.

box()
scene.caption = "Final kinetic energy = \\( \\dfrac {1} {2}mv_i^{2}+\\int
_{i}^{f}\\vec{F}\\circ d \\vec{r} \\)"
MathJax.Hub.Queue(["Typeset",MathJax.Hub])

box()
scene.caption = "$\\dfrac {5} {7}$"
scene.append_to_caption("$$a^b$$")
scene.append_to_caption("\\begin{bmatrix} 1 & 2 & 3\\end{bmatrix}")
MathJax.Hub.Queue(["Typeset",MathJax.Hub])
MathJax.Hub.Queue(["Typeset",MathJax.Hub])
텍스트를 동적으로 변경하려면 MathJax.Hub.Queue(["Typeset",MathJax.Hub])는 업데이트 후 매번 호출하여 latex를 다시 렌더해야 한다.
box()
scene.title = "\\(\\dfrac {5} {7} \\)"
def latex():
scene.title = "\\(\\dfrac {3y} {4x} \\)"
MathJax.Hub.Queue(["Typeset",MathJax.Hub]) # re-render latex
button(bind=latex,text='change')
Cloning
copyObj = obj.clone을 사용하여 obj를 복제 / 복사한다.
b = box(pos=vector(1,1,0))
bcopy = b.clone(pos=vector(1,-1,0))
https://www.glowscript.org/docs/VPythonDocs/clone.html
VPython Help
You can clone objects: b = box(pos=vector(1,1,0), axis=vector(1,1,0), color=color.red) bcopy = b.clone(pos=vector(1,-1,0)) This will give you two copies of a box, differing only in their positions. After making the clone, changes
www.glowscript.org
Compound
newObj = compound([obj1, obj2])를 사용하여 obj1과 obj2를 하나의 객체, newObj로 결합한다. 이제 newObj 호출만으로 두 객체를 제어할 수 있다.
handle = cylinder( size=vector(1,.2,.2), color=vector(0.72,0.42,0) )
head = box(size=vector(.2,.6,.2),pos=vector(1.1,0,0),color=color.gray(.6))
hammer = compound([handle, head])
https://www.glowscript.org/docs/VPythonDocs/compound.html
VPython Help
The compound object lets you group objects together and manage them as though they were one object, by specifying in the usual way pos, color, size (or length, width, height), axis, up, opacity, shininess, emissive, and texture. Moreover, the display of a
www.glowscript.org
'Python Library > VPython' 카테고리의 다른 글
[VPython] Miscellaneous (3) (0) | 2022.01.18 |
---|---|
[VPython] Miscellaneous (2) (0) | 2022.01.18 |
[VPython] Mouse and Keyboard Events (0) | 2022.01.18 |
[VPython] Math Functions (0) | 2022.01.18 |
[VPython] Animations (0) | 2022.01.18 |