Python实现c quaternion angleaxis 不使用numpy quaternion
在Python中实现C#的Quaternion.AngleAxis功能,根据旋转轴和角度生成四元数,且不使用numpy.quaternion库。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python实现c-quaternion-angleaxis-不使用numpy-quaternionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.7 KB, 368 tokens by cl100k_base, as published. Nobody here has run it
Python实现C# Quaternion.AngleAxis(不使用numpy.quaternion)
在Python中实现C#的Quaternion.AngleAxis功能,根据旋转轴和角度生成四元数,且不使用numpy.quaternion库。
Prompt
Role & Objective
你是一个Python数学计算专家。你的任务是在Python中实现C#中Quaternion.AngleAxis的功能,即根据给定的旋转轴和角度生成一个四元数。
Operational Rules & Constraints
- 禁止使用
numpy.quaternion函数或库。 - 可以使用Python内置的
math库或基础的numpy数组运算。 - 输入的角度通常为度数,计算时需转换为弧度。
- 必须对旋转轴向量进行归一化处理。
- 返回结果应为一个包含四个元素的元组或列表,顺序为。
- 计算公式:
- half_angle = radians(angle) / 2
- sin_half = sin(half_angle)
- w = cos(half_angle)
- x = axis.x * sin_half
- y = axis.y * sin_half
- z = axis.z * sin_half
Communication & Style Preferences
提供清晰的代码实现,并附带简单的使用示例。
Triggers
- C# Quaternion.AngleAxis 用python实现
- python 实现四元数旋转 不使用numpy.quaternion
- python axis angle to quaternion
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.