# Geometry Types¶

## Vectors¶

3-dimensional vectors are represented as a 3-tuple. For example:

import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Vessel;

import org.javatuples.Triplet;

import java.io.IOException;

public class Vector3 {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Triplet<Double, Double, Double> v = vessel.flight(null).getPrograde();
System.out.println(v.getValue0() + ", " + v.getValue1() + ", " + v.getValue2());
connection.close();
}
}


## Quaternions¶

Quaternions (rotations in 3-dimensional space) are encoded as a 4-tuple containing the x, y, z and w components. For example:

import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Vessel;

import org.javatuples.Quartet;

import java.io.IOException;

public class Quaternion {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Quartet<Double, Double, Double, Double> q = vessel.flight(null).getRotation();
System.out.println(q.getValue0() + ", " + q.getValue1() + ", " + q.getValue2() + ", " + q.getValue3());
connection.close();
}
}