コード例 #1
0
ファイル: check_line.c プロジェクト: xaphiriron/beyond
void lengthen_setup (void) {
  j = line_create (100.0, 0.0, 100.0, 100.0);
  f = vectorCreate (0.0, 0.0, 0.0);
  g = vectorCreate (0.0, 0.0, 0.0);
  h = vectorCreate (0.0, 0.0, 0.0);
  i = vectorCreate (0.0, 0.0, 0.0);
}
コード例 #2
0
ファイル: check_line.c プロジェクト: xaphiriron/beyond
END_TEST

START_TEST (test_line_throughpoint) {
  VECTOR3
   a = vectorCreate (100.0, 5.56, 0.0),
   b = vectorCreate (5012.0, -12.45, 0.0),
   m = vectorCreate (0.0, 0.0, 0.0);
  float
   x = 0, y = 0;
  LINE * q = line_createThroughPoints (&a, &b, LINE_DONOTSET);
  line_coordsAtT (q, 0, &x, &y);
  m = vectorCreate (x, y, 0.0);
  fail_unless (
    vector_cmp (&a, &m) == true,
    "When creating a line through two points, the first point must correspond to a T value of 0. (expecting %.3f,%.3f, got %.3f,%.3f)",
    a.x, a.y, x, y
  );
  line_coordsAtT (q, 1, &x, &y);
  m = vectorCreate (x, y, 0.0);
  fail_unless (
    vector_cmp (&b, &m) == true,
    "When creating a line through two points, the second point must correspond to a T value of 1. (expecting %.3f,%.3f, got %.3f,%.3f)",
    a.x, a.y, x, y
  );
}
コード例 #3
0
ファイル: hex_utility.c プロジェクト: xaphiriron/beyond
VECTOR3 hex_tileDistance (int length, unsigned int dir)
{
	int
		l = (dir + 5) % 6;
	VECTOR3
		r = vectorCreate (0.0, 0.0, 0.0);
	if (length == 0 || dir > 5)
	{
		return r;
	}
	r = vectorCreate (H[dir][0] + H[l][0], 0.0, H[dir][1] + H[l][1]);
	r = vectorMultiplyByScalar (&r, length);
	return r;
}
コード例 #4
0
ファイル: collision.c プロジェクト: xaphiriron/beyond
bool line_polyHit (const LINE3 * const line, int points, const VECTOR3 * const poly, float * tAtIntersection)
{
	VECTOR3
		u, v,
		plane,
		hit;
	LINE3
		transLine;
	float
		t;
	u = vectorSubtract (&poly[1], &poly[0]);
	v = vectorSubtract (&poly[2], &poly[0]);
	plane = vectorCross (&u, &v);
	plane = vectorNormalize (&plane);

	// see note in the line_triHit function
	transLine.origin = vectorSubtract (&line->origin, &poly[0]);
	transLine.dir = line->dir;
	if (!line_planeHit (&transLine, &plane, &t))
		return false;
	hit = vectorCreate
	(
		line->origin.x + line->dir.x * t,
		line->origin.y + line->dir.y * t,
		line->origin.z + line->dir.z * t
	);
	if (pointInPoly (&hit, points, poly))
	{
		if (tAtIntersection)
			*tAtIntersection = t;
		return true;
	}
	return false;
}
コード例 #5
0
ファイル: boat.c プロジェクト: henriquegemignani/yarco
boat boatCreate(texture tex, point pos, velocity vel)
{
    boat b;
    static double boatRadius = -1;
    if (boatRadius == -1)
        boatRadius = configGetValue("Radius", "Boat").real;

    b = objectCreate(TYPE_BOAT, 0, pos, vel, boatRadius, tex);
    AUTOMALLOC(b->extra);
    b->extra->accel = boatDefaults.accel;
    b->extra->life = boatDefaults.lives;
    b->extra->friction = boatDefaults.friction;
    b->extra->anchorMultiplier = boatDefaults.anchorMultiplier;
    b->extra->turnRate = boatDefaults.turnRate;
    b->extra->defaultTimeStuck = boatDefaults.timeStuck;
    b->extra->unloadTime = boatDefaults.unloadTime;
    b->extra->unloadDistance = boatDefaults.unloadDistance;
    b->extra->extraLifeScore = boatDefaults.extraLifeScore;
    b->extra->maxAnchorSpeed = boatDefaults.maxAnchorSpeed;
    b->extra->color = b->tex.color;
    b->extra->isAnchored = 0;
    b->extra->isTurning = 0;
    b->extra->isAccel = 0;
    b->extra->anchorButtonHeld = 0;
    b->extra->peopleHeld = 0;
    b->extra->points = 0;
    b->extra->unloadTimeLeft = b->extra->unloadTime;
    b->extra->timeStuckLeft = 0;
    b->extra->personList = NULL;
    b->extra->extraLivesCount = 1;
    b->extra->prevVel = vectorCreate(0,0);
    return b;
}
コード例 #6
0
ファイル: comp_chaser.c プロジェクト: xaphiriron/beyond
void chaser_update (Dynarr entities)
{
    Entity
    active;
    int
    i = 0,
    j = 0;
    Chaser
    chaser;
    struct target_info
        * target;
    VECTOR3
    direction,
    distance;
    while ((active = *(Entity *)dynarr_at (entities, i++)))
    {
        chaser = component_getData (entity_getAs (active, "chaser"));
        direction = vectorCreate (0, 0, 0);
        j = 0;
        while ((target = *(struct target_info **)dynarr_at (chaser->targets, j++)))
        {
            distance = position_distanceBetween (active, target->target);
            distance = vectorNormalize (&distance);
            distance = vectorMultiplyByScalar (&distance, target->weight);
            direction = vectorAdd (&direction, &distance);
        }
        direction = vectorNormalize (&direction);
        // direction is NaN; can't use
        if (direction.x != direction.x || direction.z != direction.z)
            continue;
        position_face (active, &direction);
        walking_start (active);
    }
}
コード例 #7
0
ファイル: ship.c プロジェクト: henriquegemignani/yarco
ship shipCreate(point pos, texture tex)
{
    static double shipRadius = -1;
    if (shipRadius == -1)
        shipRadius = configGetValue("Radius", "Ship").real;
    return objectCreate(TYPE_SHIP, 0, pos, vectorCreate(0, 0), shipRadius,
                        tex);
}
コード例 #8
0
ファイル: lmHandler.c プロジェクト: OpenJAUS/openjaus
LargeMessageList lmListCreate(void)
{
	LargeMessageList msgList = (LargeMessageList)malloc(sizeof(LargeMessageListStruct));
	msgList->commandCode = 0;
	msgList->source = jausAddressCreate();
	msgList->messages = vectorCreate();
	return msgList;
}
コード例 #9
0
ファイル: raytrace.c プロジェクト: wito/raytrace
Line *createLine(vector camera, png_uint_32 x, png_uint_32 y) {
  Line *retval = malloc(sizeof(Line));

  retval->start = camera;

  vector planePoint = vectorCreate(-8.0 + 16.0 * ((double)x / (double)WIDTH), 0.0, 10.0 - 10.0 * ((double)y / (double)HEIGHT));
  vector dir = vectorSubtraction(planePoint, camera);

  retval->end = vectorAddition(camera, vectorMultiply(dir,50));

  return retval;
}
コード例 #10
0
VECTOR3 position_distanceBetween (Entity e, Entity t)
{
	POSITION
		ep = component_getData (entity_getAs (e, "position")),
		tp = component_getData (entity_getAs (t, "position"));
	VECTOR3
		distance = vectorCreate (0, 0, 0);
	if (!ep || !tp)
		return distance;
	distance = mapDistance (ep->position, tp->position);
	return distance;
}
コード例 #11
0
ファイル: lmHandler.c プロジェクト: OpenJAUS/openjaus
LargeMessageHandler lmHandlerCreate(void)
{
	LargeMessageHandler lmh = (LargeMessageHandler)malloc( sizeof(LargeMessageHandlerStruct) );
	if(lmh)
	{
		lmh->messageLists = vectorCreate();
		return lmh;
	}
	else
	{
		return NULL;
	}
}
コード例 #12
0
VECTOR3 position_renderCoords (Entity e)
{
	VECTOR3
		platter,
		total;
	POSITION
		position = component_getData (entity_getAs (e, "position"));
	if (!position->position)
		return vectorCreate (0.0, 0.0, 0.0);
	platter = renderOriginDistance (hexPos_platter (position->position, 1));
	total = vectorAdd (&platter, &position->pos);
	return total;
}
コード例 #13
0
static void position_updateAxesFromOrientation (POSITION pdata)
{
	QUAT
		r;
	if (pdata == NULL || pdata->dirty == false)
		return;
	r = pdata->orientation;
	/* FIXME?: wait, why are the side and front vectors transposed here? I
	 * guess it doesn't really matter, but...
	 *  - xph 2011-03-10
	 */
	// these values constitute a 3x3 rotation matrix. opengl offsets are commented on each value. see the camera component for how these are used to create the cameraview matrix.
	pdata->view.side.x =		// [0]
		1 -
		2 * r.y * r.y -
		2 * r.z * r.z;
	pdata->view.side.y =		// [4]
		2 * r.x * r.y -
		2 * r.w * r.z;
	pdata->view.side.z =		// [8]
		2 * r.x * r.z +
		2 * r.w * r.y;
	pdata->view.up.x =			// [1]
		2 * r.x * r.y +
		2 * r.w * r.z;
	pdata->view.up.y =			// [5]
		1 -
		2 * r.x * r.x -
		2 * r.z * r.z;
	pdata->view.up.z =			// [9]
		2 * r.y * r.z -
		2 * r.w * r.x;
	pdata->view.front.x =		// [2]
		2 * r.x * r.z -
		2 * r.w * r.y;
	pdata->view.front.y =		// [6]
		2 * r.y * r.z +
		2 * r.w * r.x;
	pdata->view.front.z =		// [10]
		1 -
		2 * r.x * r.x -
		2 * r.y * r.y;
	pdata->move.front = vectorCross (&pdata->view.side, &pdata->move.up);
	pdata->move.front = vectorNormalize (&pdata->move.front);
	pdata->move.side = vectorCross (&pdata->move.up, &pdata->view.front);
	pdata->move.side = vectorNormalize (&pdata->move.side);
	pdata->move.up = vectorCreate (0, 1, 0);
	pdata->orientation = quat_normalize (&pdata->orientation);
	pdata->dirty = false;
}
コード例 #14
0
static inline void drawVector(Vector position, Vector vector, Color lineColor, Color endColor) {
	if (vectorGetLengthSq(vector) < 0.001) {
		return;
	}

	Vector sum = vectorSum(position, vector);
	glColor3f(lineColor.r, lineColor.g, lineColor.b);
	glBegin(GL_LINES);
		glVertex3d(position.x, position.y, position.z);
		glVertex3d(sum.x, sum.y, sum.z);
	glEnd();

	static double endSize = 0.05;
	renderCube(sum, vectorCreate(endSize, endSize, endSize), endColor);
}
コード例 #15
0
ファイル: boat.c プロジェクト: henriquegemignani/yarco
boat boatNew(int player)
{
    int numPlayers = configGetValue("General", "NumPlayers").num;
    double startAngle = PI - player * 2 * PI / numPlayers;
    point pos = vectorCreate(MAX_X / 2 + MAX_X / 8 * cos(startAngle),
                             MAX_Y / 2 + MAX_Y / 8 * sin(startAngle));
    velocity vel = vectorCreate(0, 0);
    boat b;
    texture tex;

    char confgroup[8];
    strcpy(confgroup, "PlayerX");
    confgroup[6] = '1' + player;

    tex.color = configGetValue(confgroup, "Color").num;
    tex.type = TEX_TRIANGLE;
    b = boatCreate(tex, pos, vel);
    b->dir = PI / 2;
    b->extra->player = player;
    boatGetControls(b, player);
    b->extra->respawnPoint = b->pos;
    b->extra->name = configGetValue(confgroup, "Name").str;
    return b;
}
コード例 #16
0
ファイル: init.c プロジェクト: BG1/warzone2100
void widgetSDLInit()
{
	// Get information about the current surface
	SDL_Surface *surface = SDL_GetVideoSurface();

	// Set the screen size
	windowSetScreenSize(surface->w, surface->h);
	
	// Initialise the SVG manager
	svgManagerInit();
	
	// Initialise the pattern manager
	patternManagerInit();

	// Create an initial window vector to store windows
	windowSetWindowVector(vectorCreate());
}
コード例 #17
0
ファイル: texture.c プロジェクト: xaphiriron/beyond
void textureDrawHex (TEXTURE t, VECTOR3 centre, unsigned int size, float angle)
{
	VECTOR3
		axis = vectorCreate (
			cos (angle) * size,
			sin (angle) * size,
			0
		),
	// rotation A is by 60 degrees; rotation B is by 120 degrees
		rotA = vectorCreate (
			cos (angle + M_PI * .333) * size,
			sin (angle + M_PI * .333) * size,
			0
		),
		rotB = vectorCreate (
			cos (angle + M_PI * .666) * size,
			sin (angle + M_PI * .666) * size,
			0
		),
		corners[6];
	int
		i = 0;

	corners[0] = vectorCreate (centre.x + axis.x, centre.y + axis.y, 0);
	corners[1] = vectorCreate (centre.x + rotA.x, centre.y + rotA.y, 0);
	corners[2] = vectorCreate (centre.x + rotB.x, centre.y + rotB.y, 0);
	corners[3] = vectorCreate (centre.x - axis.x, centre.y - axis.y, 0);
	corners[4] = vectorCreate (centre.x - rotA.x, centre.y - rotA.y, 0);
	corners[5] = vectorCreate (centre.x - rotB.x, centre.y - rotB.y, 0);

	while (i < 6)
	{
		textureDrawLine (t, corners[i], corners[(i + 1) % 6]);
		i++;
	}
	//printf ("FLOODING\n");
	textureFloodFill (t, (signed int)centre.x, (signed int)centre.y);
}
コード例 #18
0
ファイル: hex_utility.c プロジェクト: xaphiriron/beyond
VECTOR3 hex_coord2space (unsigned int r, unsigned int k, unsigned int i)
{
	VECTOR3
		p = vectorCreate (0.0, 0.0, 0.0),
		q;
	if (r == 0)
	{
		return p;
	}
	assert (k < 6);
	assert (i < r);
	p = hex_tileDistance (r, k);
	if (i == 0)
	{
		return p;
	}
	q = hex_tileDistance (i, (k + 2) % 6);
	p = vectorAdd (&p, &q);
	return p;
}
コード例 #19
0
static void position_create (EntComponent comp, EntSpeech speech)
{
	struct position_data
		* position = xph_alloc (sizeof (struct position_data));
	position->sensitivity = 0.20;

	position->view.side = vectorCreate (1.0, 0.0, 0.0);
	position->move.side = vectorCreate (1.0, 0.0, 0.0);
	position->view.up = vectorCreate (0.0, 1.0, 0.0);
	position->move.up = vectorCreate (0.0, 1.0, 0.0);
	position->view.front = vectorCreate (0.0, 0.0, 1.0);
	position->move.front = vectorCreate (0.0, 0.0, 1.0);
	position->orientation = quat_create (1.0, 0.0, 0.0, 0.0);

	position->position = NULL;
	position->pos = vectorCreate (0, 0, 0);

	component_setData (comp, position);
}
コード例 #20
0
ファイル: table.cpp プロジェクト: ArtemusRus/warzone2100
void tableInit(table *self, const char *id)
{
	// Init our parent
	widgetInit(WIDGET(self), id);
	
	// Prepare our vtable
	tableInitVtbl(self);
	
	// Set our type
	WIDGET(self)->classInfo = &tableClassInfo;
	
	// Prepare our child postional info container
	self->childPositions = vectorCreate();
	
	// We have no children and therefore no rows/columns
	self->numRows = self->numColumns = 0;
	
	// Default alignment is TOP LEFT
	tableSetDefaultAlign(self, TOP, LEFT);
	
	// Padding is 0
	self->rowPadding = self->columnPadding = 0;
}
コード例 #21
0
ファイル: video_gr.c プロジェクト: gtugablue/LCOM-Racinix
int vg_draw_polygon(vector2D_t polygon[], unsigned n, unsigned long color)
{
	size_t i, j;
	vector2D_t min = polygon[0];
	vector2D_t max = polygon[0];
	for (i = 1; i < n; ++i)
	{
		if (polygon[i].x < min.x)
		{
			min.x = polygon[i].x;
		}
		else if (polygon[i].x > max.x)
		{
			max.x = polygon[i].x;
		}
		if (polygon[i].y < min.y)
		{
			min.y = polygon[i].y;
		}
		else if (polygon[i].y > max.y)
		{
			max.x = polygon[i].y;
		}
	}
	vector2D_t point;
	for (i = min.x; i < max.x; ++i)
	{
		for (j = min.y; j < max.y; ++j)
		{
			point = vectorCreate(i, j);
			if (isPointInPolygon(polygon, n, point))
			{
				vg_set_pixel(i, j, color);
			}
		}
	}
}
コード例 #22
0
ファイル: collision.c プロジェクト: xaphiriron/beyond
bool line_triHit (const LINE3 * const line, const VECTOR3 * const tri, float * tAtIntersection)
{
	VECTOR3
		u, v,
		triPlane,
		hit;
	LINE3
		transLine;
	float
		t,
		weight[3];
	u = vectorSubtract (&tri[2], &tri[0]);
	v = vectorSubtract (&tri[1], &tri[0]);
	triPlane = vectorCross (&u, &v);
	// the planeHit code doesn't have a magnitude argument so it's always a test against the plane through the origin. thus to accurately test we have to translate the line so that it's positioned relative to the plane origin (which we're arbitrarily using tri->pts[0] as) - xph 02 13 2012
	transLine.origin = vectorSubtract (&line->origin, &tri[0]);
	transLine.dir = line->dir;
	if (!line_planeHit (&transLine, &triPlane, &t))
		return false;
	hit = vectorCreate
	(
		transLine.origin.x + line->dir.x * t,
		transLine.origin.y + line->dir.y * t,
		transLine.origin.z + line->dir.z * t
	);
	baryWeights (&hit, &u, &v, weight);
	if (weight[0] >= 0.00 && weight[0] <= 1.00 &&
		weight[1] >= 0.00 && weight[1] <= 1.00 &&
		weight[2] >= 0.00 && weight[2] <= 1.00)
	{
		if (tAtIntersection)
			*tAtIntersection = t;
		return true;
	}
	return false;
}
コード例 #23
0
ファイル: lab23_var18.c プロジェクト: BlagoProg/MAI
int main(void)
{
	int i, maxBFS;
	char cmd[255], arg;
	TreeNode *root = NULL, *tmpNode = NULL;
	Vector v;

	do
	{
		printf("Введите команду (h - справка):\n");
		scanf("%s", cmd);

		if (cmd[0] == '+')
		{
			scanf(" %c", &arg);

			if (cmd[1] == 'r')
			{
				if (root == NULL)
				{
					if (arg >= 'A' && arg <= 'Z')
					{
						treeAddNode(&root, arg - 'A');

						printf("Корень %c создан\n", arg);
					}
					else
						printf("Ошибка. Введена недопустимая буква\n");
				}
				else
					printf("Корень уже существует\n");
			}
			else if (root == NULL)
				printf("Корень не создан\n");
			else
			{
				tmpNode = root;

				if (cmd[1] != '\0')
					tmpNode = getNodeByPath(&root, &cmd[1]);

				if (tmpNode == NULL)
					printf("Ошибка. Такого пути не существует\n");
				else if (arg >= 'A' && arg <= 'Z')
				{
					if (treeAddNode(&tmpNode, arg - 'A') != NULL)
						printf("Узел %c добавлен к узлу %c\n", arg, tmpNode->_data + 'A');
				}
				else
					printf("Ошибка. Введена недопустимая буква\n");
			}
		}
		else if (cmd[0] == '-')
		{
			scanf(" %c", &arg);

			if (arg >= 'A' && arg <= 'Z')
			{
				if (treeRemoveNode(&root, arg - 'A'))
					printf("Узел %c удален\n", arg);
				else
					printf("Узел %c не найден\n", arg);
			}
			else
				printf("Ошибка. Введена недопустимая буква\n");
		}
		else if (cmd[0] == 'p')
		{
			KLP(&root, 0);
		}
		else if (cmd[0] == 't')
		{
			if (root != NULL)
			{
				vectorCreate(&v, treeDFS(&root));

				for (i = 0; i < vectorSize(&v); i++)
					vectorSave(&v, i, 0);

				countNodesOnLevels(&root, &v, 0);

				maxBFS = 0;

				for (i = 0; i < vectorSize(&v); i++)
					if (vectorLoad(&v, i) > maxBFS)
						maxBFS = vectorLoad(&v, i);

				printf("Ширина дерева: %d\n", maxBFS);

				vectorDestroy(&v);
			}
			else
				printf("Дерево пусто\n");
		}
		else if (cmd[0] == 'h')
		{
			printf("================================\n");
			printf("Список команд:\n");
			printf("+r CHAR - создать корень CHAR (A, B, ..., Z)\n");
			printf("+ CHAR - добавить сына CHAR к корню\n");
			printf("+PATH CHAR - добавить CHAR узел по заданому пути (s - сын, b - брат)\n");
			printf("- CHAR - удалить первый найденный узел CHAR и его поддерево\n");
			printf("p - распечатать дерево\n");
			printf("t - выполнить задание над деревом\n");
			printf("q - завершить программу\n");
			printf("================================\n");
		}
		else if (cmd[0] != 'q')
		{
			printf("Неизвестная команда\n");
		}
	}
	while (cmd[0] != 'q');

	treeDestroy(&root);

	return 0;
}
コード例 #24
0
ファイル: vector.c プロジェクト: wito/yaps
vector vectorAddition(vector a,vector b) {
    return vectorCreate(a.x + b.x, a.y + b.y, a.z + b.z);
}
コード例 #25
0
ファイル: texture.c プロジェクト: xaphiriron/beyond
void textureFloodFill (TEXTURE t, signed int startX, signed int startY)
{
	unsigned char
		replaceColor[4] = {0, 0, 0, 0};
	struct txpx {
		signed int
			x,y;
	} * current,
	  * next;
	VECTOR3
		loc;
	Dynarr
		affectedPixels;

	if (TextureColor[3] == 0x00)
	{
		ERROR ("Can't flood fill with a transparent color.");
		return;
	}

	loc = vectorCreate (startX, startY, 0);
	
	if (textureOOB (t, loc))
	{
		INFO ("Can't centre flood at %d, %d; it's out of bounds of image (%dx%d)", startX, startY, t->width, t->height);
		return;
	}
	affectedPixels = dynarr_create (64, sizeof (struct txpx *));
	memcpy (replaceColor, textureColorAt (t, loc), t->mode);

	current = xph_alloc (sizeof (struct txpx));
	current->x = startX;
	current->y = startY;
	dynarr_queue (affectedPixels, current);

	while (!dynarr_isEmpty (affectedPixels))
	{
		current = *(struct txpx **)dynarr_dequeue (affectedPixels);
		//printf ("got: %d, %d\n", current->x, current->y);
		loc = vectorCreate (current->x, current->y, 0);
		if (textureOOB (t, loc))
		{
		}
		else if (memcmp (replaceColor, textureColorAt (t, loc), t->mode) == 0)
		{
			textureDrawPixel (t, loc);

			next = xph_alloc (sizeof (struct txpx));
			next->x = current->x + 1;
			next->y = current->y;
			dynarr_queue (affectedPixels, next);

			next = xph_alloc (sizeof (struct txpx));
			next->x = current->x;
			next->y = current->y + 1;
			dynarr_queue (affectedPixels, next);

			next = xph_alloc (sizeof (struct txpx));
			next->x = current->x - 1;
			next->y = current->y;
			dynarr_queue (affectedPixels, next);

			next = xph_alloc (sizeof (struct txpx));
			next->x = current->x;
			next->y = current->y - 1;
			dynarr_queue (affectedPixels, next);
		}
		xph_free (current);
	}

	INFO ("FINAL SIZE: %d ENTRIES", dynarr_capacity (affectedPixels));
	dynarr_destroy (affectedPixels);
}
コード例 #26
0
ファイル: vector.c プロジェクト: wito/yaps
vector vectorSubtraction(vector a, vector b) {
    return vectorCreate(a.x - b.x, a.y - b.y, a.z - b.z);
}
コード例 #27
0
ファイル: vector.c プロジェクト: henriquegemignani/yarco
vector vectorDiv(vector v, double div)
{
    return vectorCreate(v.x / div, v.y / div);
}
コード例 #28
0
ファイル: vector.c プロジェクト: wito/yaps
vector vectorXProduct(vector a, vector b) {
    return vectorCreate(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
}
コード例 #29
0
ファイル: vector.c プロジェクト: wito/yaps
vector vectorDivide(vector self, double r) {
    return vectorCreate(self.x / r, self.y / r, self.z / r);
}
コード例 #30
0
ファイル: vector.c プロジェクト: wito/yaps
vector vectorMultiply(vector self, double r) {
    return vectorCreate(self.x * r, self.y * r, self.z * r);
}