Skip to content
Back to skills

使用Glm实现Vector3transformnormal和Vector3transformcoord函数

ASecurity

使用GLM库实现向量变换函数Vector3TransformNormal(法线变换)和Vector3TransformCoord(坐标变换),并要求形参使用const T&模板引用以支持泛型。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationc++

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill '使用glm实现vector3transformnormal和vector3transformcoord函数' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 使用Glm实现Vector3transformnormal和Vector3transformcoord函数?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 使用Glm实现Vector3transformnormal和Vector3transformcoord函数
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-glm-vector3transformnormal-vector3transformcoord/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-glm-vector3transformnormal-vector3transformcoord)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.