+
Skip to content

A header-only lightweight vector 2D library made by abusing macros in conjunction with `complex.h`

License

Notifications You must be signed in to change notification settings

XnLogicaL/vec2.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vec2.c

Hacky 2D vector library that abuses macros & complex.

Inspired by endoh1.c

Usage

#include "vec2.h"

int main(void) {
  vec2(int) v2i = vec2_new(34, 35);
  vec2(float) v2f = vec2_new(34.0, 35.0);
  vec2(float) total = v2i + v2f;
  vec2(float) dot = vec2_dot(total, total * 2);

  printf("[%f, %f]", vec2_x(dot), vec2_y(dot));
}

Installation

Just copy vec2.h into your include folder.

About

A header-only lightweight vector 2D library made by abusing macros in conjunction with `complex.h`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载