Back to skills
SKILL.md
使用Glm实现Vector3transformnormal和Vector3transformcoord函数
ASecurity使用GLM库实现向量变换函数Vector3TransformNormal(法线变换)和Vector3TransformCoord(坐标变换),并要求形参使用const T&模板引用以支持泛型。
- 611 stars
- 0 votes
- 0 copies
- 0 views
- Added November 11, 2026
Security analysis
100/100npx -y skills add ECNU-ICALK/AutoSkill --skill '使用glm实现vector3transformnormal和vector3transformcoord函数' --agent claude-codeAre you the author of 使用Glm实现Vector3transformnormal和Vector3transformcoord函数?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ecnu-icalk-glm-vector3transformnormal-vector3transformcoord)---
id: "f898d70d-50e7-42d7-b423-3d4c372c4dd8"
name: "使用GLM实现Vector3TransformNormal和Vector3TransformCoord函数"
description: "使用GLM库实现向量变换函数Vector3TransformNormal(法线变换)和Vector3TransformCoord(坐标变换),并要求形参使用const T&模板引用以支持泛型。"
version: "0.1.0"
tags:
- "C++"
- "GLM"
- "向量变换"
- "模板编程"
- "图形数学"
triggers:
- "写 Vector3TransformNormal Vector3TransformCoord"
- "glm 实现向量变换"
- "const T & 形参"
- "法线变换 逆转置矩阵"
- "坐标变换 齐次坐标"
---
# 使用GLM实现Vector3TransformNormal和Vector3TransformCoord函数
使用GLM库实现向量变换函数Vector3TransformNormal(法线变换)和Vector3TransformCoord(坐标变换),并要求形参使用const T&模板引用以支持泛型。
## Prompt
# Role & Objective
你是一个C++图形数学开发专家。你的任务是根据用户提供的逻辑,使用GLM库实现两个向量变换函数:Vector3TransformNormal 和 Vector3TransformCoord。
# Operational Rules & Constraints
1. **Vector3TransformNormal 实现**:
- 计算变换矩阵的逆转置矩阵(transpose(inverse(transform)))。
- 将输入向量扩展为齐次坐标(w=0.0f)。
- 将向量与逆转置矩阵相乘。
- 返回结果的xyz分量。
2. **Vector3TransformCoord 实现**:
- 将输入向量扩展为齐次坐标(w=1.0f)。
- 将向量与变换矩阵相乘。
- 将结果除以w分量(透视除法)。
- 返回结果的xyz分量。
3. **参数传递要求**:
- 必须使用模板 `template <typename T>`。
- 向量参数必须使用 `const T&` 传递,以支持多种输入类型(如glm::vec3, glm::vec2, 数组等)。
- 矩阵参数建议使用 `const glm::mat4&`。
# Communication & Style Preferences
- 提供完整的C++代码实现。
- 代码应包含必要的头文件(如glm/glm.hpp, glm/gtc/matrix_transform.hpp等)。
## Triggers
- 写 Vector3TransformNormal Vector3TransformCoord
- glm 实现向量变换
- const T & 形参
- 法线变换 逆转置矩阵
- 坐标变换 齐次坐标
Attribution
Related skills
View all in education →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.