1. A method for registering data, comprising steps of: acquiring the data from a scene by a sensor at different viewpoints; extracting, from the data, three-dimensional (3D) points and 3D lines, and descriptors associated with the 3D points and the 3D lines, wherein each 3D line is extracted as a ray connecting an optional center of the sensor with a two-dimensional (2) point; selecting a first set of primitives represented in a first coordinate system of the sensor, wherein the first set of primitives includes at least three 3D points; selecting a second set of primitives represented in a second coordinate system, wherein the second set of primitives includes any combination of 3D points and 3D lines to obtain at least three primitives; and registering, using the first set of primitives and the second set of primitives, the 3D points with each other using point-to-point correspondence, and the 3D points with the 3D lines using point-to-line correspondence to obtain registered primitives, wherein the registered primitives are used in a simultaneous localization and mapping (SLAM) system, and wherein the steps are performed in a processor.