<p>A line generator includes a light source, a first lens group, and a second lens group. With the position of a luminous flux that perpendicularly enters surfaces of both the first lens group and the second lens group as an optical axis, the first lens group collimates or collects the luminous flux outputted from the light source in a first direction within a plane perpendicular to the optical axis and specifies the width of a line, and the second lens group diffuses the luminous flux passed through the first lens group in a second direction which orthogonally intersects the first direction within the plane perpendicular to the optical axis and forms the line.</p>