This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
wilcomega's profile picture

[1.31]Vector

Started by wilcomega, 13 March 2012 - 05:19 PM
wilcomega #1
Posted 13 March 2012 - 06:19 PM
What is Vector and what can i do with it?
there is no good hel avalible in terminal itself and the wiki has no article

thx wilcomega
Casper7526 #2
Posted 13 March 2012 - 06:20 PM
Vector is used in the GPS api programs.
wilcomega #3
Posted 13 March 2012 - 06:23 PM

so nothing with grapics?
Espen #4
Posted 13 March 2012 - 06:43 PM
What is Vector and what can i do with it?
there is no good hel avalible in terminal itself and the wiki has no article

thx wilcomega
There is no special help, because a vector is nothing CC specific, it's math.
In CC it's implemented as a Lua object with 3 coordinates, a length, and a few functions for vector calculations.
If you're curious how it works within CC, take a look at /rom/apis/vector
Advert #5
Posted 13 March 2012 - 06:45 PM

so nothing with grapics?

A vector by itself represents some points. You could use it in graphics yourself, if you wanted to; but CC (by itself) only supports displaying of text.
Beardmoresam #6
Posted 18 March 2012 - 09:08 PM
How exactly do you use vectors? I make a new vector with vector.new( 1, 1, 1), but then how do I use it and name it ect… whenever I try to use vectorA or B it won't take it?
Advert #7
Posted 18 March 2012 - 09:33 PM
You really don't want to use vectors unless you know what you're doing with them.
Sebra #8
Posted 19 March 2012 - 05:58 PM
Are you ready to work with world coords?
Possible examples:
use turtle to make something from blocks like sphere, ellipse, cylinder, cube…
to calculate distance between two points, angle between two directions, point based on angles or distances…
determine some different paths like Archimed spiral with constant distance to itself or find a safe zone, where you will be able to use gps program…
Math is the best!
Beardmoresam #9
Posted 19 March 2012 - 06:58 PM
Basically I want to look into taking a GPS fix and putting it into the vector api for the turtle to work out where it has to go. I.E. from point A to point B, there is 120 meters at a bearing of xxx degrees, the turtle plots that against point B (it's current gps fix) and works out the components of the vector and direction so it can travel there. I know the method but my coding is pretty poor so puting it into code is another matter.
Beardmoresam #10
Posted 20 March 2012 - 10:47 PM
Anyone good at maths? I think I've got a decent equation for telling a turtle where to go: x3=(x2-x1). X3 = the x component of the vector the turtle has to move. x1 the x co-ord of the first point and x2 the x co-ord of the second point. I'm not entirely sure that works though? I'm not a maths person. Cheers.