Print at Dec 18, 2025, 3:05:01 PM View all posts in this thread on one page
Posted by enkonyito at Jul 31, 2017, 10:25:11 PM
Curved line camera path
I repeat the problematic that has been discussed in this thread .
The drawing of the curved line is made with Arc2D from 2 main locations, the orientation of the camera and the center of the ellipse.
The intermediate positions are calculated using the parametric equations of the ellipse .

The correlation established with the SH3D coordinate system only works in certain cases.
Here is the part of the code drawing the arc for panoramic videos.
float x1 = cameraPath.get(i - 1).getX();
float y1 = cameraPath.get(i - 1).getY();
float x2 = camera.getX();
float y2 = camera.getY();
double trigAng1 = (Math.PI / 2) - cameraPath.get(i - 1).getYaw();
double trigAng2 = (Math.PI / 2) - camera.getYaw();

if (trigAng1 == trigAng2) { // straight line
g2D.draw(new Line2D.Float(x1, y1, x2, y2));
} else { // curved line
double chord = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
double radius = Math.abs(chord / (2 * Math.sin((trigAng2 - trigAng1) / 2)));

Arc2D circleArc = new Arc2D.Float();
double x = x1 - (radius * Math.cos(trigAng1));
double y = y1 + (radius * Math.sin(trigAng1)); // reversed axis in sh3d
double angSt = Math.toDegrees(trigAng1);
double angExt = Math.toDegrees(trigAng2 - trigAng1);
int closure = Arc2D.OPEN;
circleArc.setArcByCenter(x, y, radius, angSt, angExt, closure);
g2D.draw(circleArc);
}

----------------------------------------
EnkoNyito

Posted by Puybaret at Aug 1, 2017, 3:01:38 PM
Re: Curved line camera path
Could you give more details about when it doesn't work?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by enkonyito at Aug 3, 2017, 10:42:37 PM
Re: Curved line camera path
Using the correlation found, the start angle depends on the orientation of the camera so sometimes the arc is badly drawn.


By discovering that we can use Math.atan2(y, x) to calculate the start angle from the position only, I will orient myself towards this solution.
----------------------------------------
EnkoNyito

Posted by enkonyito at Aug 8, 2017, 10:07:52 PM
Re: Curved line camera path
Problem solved.

----------------------------------------
EnkoNyito

Posted by jdab at Dec 5, 2017, 12:39:11 PM
Re: Curved line camera path
Hi,
As a fan user of the video mode, I'd love to use these curved line in camera path. As well, a 360° rotation around a central point would be great !
Have these been integrated in SH3D yet, or will they be soon ?
Best regards,

Posted by enkonyito at Jan 26, 2019, 3:38:44 AM
Re: Curved line camera path
As a fan user of the video mode, I'd love to use these curved line in camera path. As well, a 360° rotation around a central point would be great !
Since version 1.3 of the photo-video plug-in , the camera path can be in a curved line.

Have these been integrated in SH3D yet, or will they be soon ?
I do not know if this feature (or others) will ever be integrated with the standard version of Sweet Home 3D.
----------------------------------------
EnkoNyito