无题
title: About Medate: 4277023-10-31 23:19:32tags:484784—
About MeHi! I’m an undergraduate student at Huazhong University of Science and Technology intersted in real-time rendering algorithms, game development and 3D reconstruction. I’m currently learning path sampling related with ReSTIR pipline. But I’m also intersted in other acceleration structures that can make the real-time ray tracing more powerful. Nerf and other nerual methods that can help artists to create contents easier are also inte ...
贝塞尔曲线Bazier Curve
Bazier Curve Learning历史1959年。当时就职于雪铁龙的法国数学家 Paul de Casteljau 开始对伯恩斯坦多项式进行了图形化的尝试,并且提供了一种数值稳定的德卡斯特里奥(de Casteljau) 算法。(多数理论公式是建立在大量且系统的数学建模基础之上研究的规律性成果)根据这个算法,就可以实现**通过很少的控制点,去生成复杂的平滑曲线,也就是贝塞尔曲线** 。
数学理论(二阶贝塞尔曲线)利用等比线段的方式去快速的生成曲线,让D点在AB上运动,同时满足
$$\frac{AD}{AB} = \frac{DF}{DE} = \frac{BE}{BC}$$
这样就是二阶贝塞尔曲线的形成
N阶贝塞尔曲线与二阶贝塞尔曲线同理,在最远端取一点之后,按照二阶贝塞尔曲线的方式处理临近的边,依次递归即可得到二阶贝塞尔曲线的最近解。
Python Subprocess 调用子程序
$Python Subprocess 调用子程序$
使用场景:当你在某些情况下,需要在特定的路径下运行某些脚本,但是又需要在另一个路径下调用的时候,就需要使用Subprocess库去调用对应目录下的脚本,使其在对应的根目录下运行。
在我的开发过程中,我需要在 D:\Coding\Python\Blog\PF_AFN下运行 test.py脚本,但是我需要在 D:\Coding\Python\Blog\manager.py脚本中调用 test.py脚本,这个时候就需要使用Subprocess库去调用。
使用如下命令:
12import subprocessrc = subprocess.call(['python','test.py'], cwd = 'PF_AFN')
其中 'python', 'test.py'是命令行中的指令, cwd是需要该指令运行的对应根目录。
call函数返回0时表明运行成功,其余表示运行失败。
call函数是使主进程等待子进程完成之后再继续运行,所以当你需要使用脚 ...
Python函数装饰器Decorater()
Python函数装饰器Decorater()本文主要讲述在Python中函数的一些用法, 仅仅作为笔记记录
本文主要参考自:
Python进阶
Python 中函数作为参数传递与返回在Python中,无论何时,我们都应当牢记一点:万物都为对象。因此,在Python中,函数本身也是一个对象,可以被赋值,甚至进行值拷贝,例如下面一段代码:
12345678910111213141516# 定义一个测试函数def test_a(): print("This is a") return# 该测试函数赋值给a这个变量,再赋值给b这个变量a = test_ab = a# 删除a这个变量,此时再运行a(),程序会出错, 但是b()仍然可以调用del ab()# 删除 test_a() 这个函数, 再调用test_a() 时,程序会报错del test_a# 此时b()仍然可以调用b()# 会报错哦test_a()
由此我们可以看见,在Python中, 函数本身也是一个可以作为值传递的变量。
故而,下面的这段代码就将一个函数作为参数传递进另一个函数中:
12345 ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment