Silly question, why are LVector3 and LPoint3 different things? This seems like an unnecessary complication.
This allows us to overload methods to treat them differently. The distinction matters when, for example, when transforming them using a transformation matrix. If you multiply a point with a transformation matrix, it’ll take the translation component into account, but not if you use a vector, which only represents a direction. For homogeneous coordinates, vectors have an implied fourth component of 0 and points have an implied fourth component of 1.
Vector also provides additional methods that really only make sense for vectors and not points, such as angle_rad(), etc.
I do agree that having to distinguish between both is sometimes annoying, though.
What would be the disadvantage of merging both classes? I guess it won’t hurt if there are methods which don’t make too much sense.
Point3(0,0,1) is not the same as Vec3(0,0,1). The first is a place one unit above ground, the later a direction pointing up. You can have a distance between points or an angle between vectors
I think it may be strange when points and vectors are used for generic 3 (4) component data (like color)
wezu worded it better than I did. The numbers just mean different things, so having them conceptually separated seems wise. In more practical terms, some very important operations yield different results depending on whether you pass them a point or a vector, such as transformation. Interpolating points is different from vectors, too, and when passing them to shaders you want to control what the implicit fourth component is depending on whether you are using a point or a vector.
Note that all methods that accept a vector or point will also accept a Python tuple, so the recommended way to use setColor is to just pass a tuple.
Are points in Panda3D not just position vectors from the coordinate origin?
They are, but if you move an object relative to the origin, that vector will change. But if you use a vector to represent eg. a direction, it remains unchanged when moving that object relative to the origin.
For translation transform, homogeneous coordinates are used. When doing such a transformation, the w component for a vector is implicitly 0 whereas the w component for a point is 1 in order to cause points to be affected by translation, but not vectors.