My goal is to use a Python generator to create a spline with Bezier interpolation where each point has tangents lying in the same plane as the plane spanned by the point itself and its two adjacent points and is also parallel to the line going through the two adjacent points. C4D does this natively when you double click on a point. See the following video example:

The video does exactly what I want, but now I need to figure out the mathematics of this in the Python generator. This is the code that I have so far, but I don’t understand how to calculate the tangents to get exactly what I want:

```
def main():
verts = [c4d.Vector(50*ii, 50*(-1)**ii, 50*(-1)**int(ii/2)) for ii in range(10)] # just a sample
total_points = len(verts)
spline = c4d.SplineObject(total_points, c4d.SPLINETYPE_BEZIER)
spline.ResizeObject(total_points, 1)
spline.SetSegment(0, total_points, False)
mag = op[c4d.ID_USERDATA,1]
for pntnum, vert in enumerate(verts):
spline.SetPoint(pntnum, vert)
# i need to set the tangent here somehow!
spline.Message(c4d.MSG_UPDATE)
return spline
```

The magnitude of the tangents would be a scalar value that I would want to control separately. If you could help me figure out how to calculate the tangents that are identical to what C4D created automatically in that video (besides magnitude), that would really help me out. Does anybody know the mathematics to calculate these tangents?