Curved line camera path

This topic has been viewed 7264 times and has 5 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Curved line camera path

Post by enkonyito »

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.

Code: Select all

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
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Curved line camera path

Post by Puybaret »

Could you give more details about when it doesn't work?
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Curved line camera path

Post by enkonyito »

Using the correlation found, the start angle depends on the orientation of the camera so sometimes the arc is badly drawn.
Image Image

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
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Curved line camera path

Post by enkonyito »

Problem solved.
Image
EnkoNyito
jdab
Posts: 12
Joined: Wed Dec 28, 2016 12:22 pm

Re: Curved line camera path

Post by jdab »

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,
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Curved line camera path

Post by enkonyito »

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
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests