Apparatus is disclosed for optically detecting the position of an edge of a workpiece (such as an IC lead tip) in a sensing plane, involving the emission of electromagnetic energy from a known source region in the sensing plane such as to cause the edge to create a shadow having a penumbra in the sensing plane. Two detectors determine the amount of energy which reach two known detection regions in the sensing plane and wholly within the penumbra. The amount of energy detected by one detector determines a first curve in the sensing plane on which the edge must lie, and the amount of energy detected by the other determines a second such curve. The intersection of these two curves fully determines the position of the edge in the sensing plane. Preferably, the source region and both detector regions are all essentially line segments oriented parallel to a z-axis, the two detection regions being disposed axially but spaced from each other. Apparatus is also disclosed for determining a profile of edges on one side of the workpiece. Algorithms are disclosed for interrelating measurements taken on four sides of the workpiece, calculating coplanarity of the lead tips, and calculating tweezing coplanarity of the leads. Two calibration methods are also disclosed. Further apparatus is disclosed for rotating a workpiece by 90 degrees, for example, in order to scan leads on different sides of a package, without requiring any physical modifications for workpieces of different sizes.