Source

vectorscope / vector.h

/**
 * \file
 * Vector line drawing and fonts
 *
 */

#ifndef _vector_h_
#define _vector_h_

#include <stdint.h>


void
line_vert(
	uint8_t x0,
	uint8_t y0,
	uint8_t w
);

void
line_horiz(
	uint8_t x0,
	uint8_t y0,
	uint8_t h
);


void
line(
	uint8_t x0,
	uint8_t y0,
	uint8_t x1,
	uint8_t y1
);


typedef struct
{
	// center of rotation
	uint8_t cx;
	uint8_t cy;

	// scale of vector, divided by 16
	int8_t scale;

	// Angle from 0 to 255 (== 2 Pi)
	uint8_t theta;

	// precomputed sin/cos
	int8_t sin_t;
	int8_t cos_t;
} vector_rot_t;


void
vector_rot_init(
	vector_rot_t * r,
	uint8_t angle
);


uint8_t
vector_rot_x(
	const vector_rot_t * r,
	int8_t x,
	int8_t y
);


uint8_t
vector_rot_y(
	const vector_rot_t * r,
	int8_t x,
	int8_t y
);


uint8_t
draw_char_big(
	uint8_t x,
	uint8_t y,
	uint8_t val
);

uint8_t
draw_char_med(
	uint8_t x,
	uint8_t y,
	uint8_t val
);

uint8_t
draw_char_small(
	uint8_t x,
	uint8_t y,
	uint8_t val
);


void
draw_char_rot(
	const vector_rot_t * const r,
	int8_t x,
	int8_t y,
	char val
);

#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.