Similar to my previous question, if I create a light using user commands:
Command: RectangularLight
Rectangular light corner (Target):1,1
Rectangular light length:5,2
Rectangular light width:1
Choose rectangle < picked a point on screen
Here is my attempt in code, which is close, but not quite right:
void makeRectangularLight(CRhinoDoc * rDoc)
{
ON_Light light;
light.SetStyle(ON::LightStyle(ON::world_rectangular_light));
ON_3dPoint start(1, 1, 0);
ON_3dPoint end(5, 2, 0);
ON_3dVector dirVec(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
double length = start.DistanceTo(end);
light.SetLocation(start);
light.SetDirection(dirVec);
light.SetLength(dirVec);
if (light.IsValid())
{
CRhinoLightTable& light_table = rDoc->m_light_table;
light_table.AddLight(light);
}
}