Discussion:
How to draw line with QML/3D
Marko Heikkilä
2010-09-16 08:14:42 UTC
Permalink
Hi,

What is the easiest way to draw a line to 3D space with QML?
Lets say that I wan to draw a red line from 3D position A to 3D position B.
r***@public.gmane.org
2010-09-16 08:42:13 UTC
Permalink
>What is the easiest way to draw a line to 3D space with QML?
>Lets say that I wan to draw a red line from 3D position A to 3D position B.

At the moment, this isn't possible with QML/3D unless you write
your own C++ plugin that adds a new QML Line3D element or
something similar. Another method is to create an external
.obj file that contains a line (probably a tube made up of triangles)
and then position and stretch that. That's a bit yucky though.

We generally discourage raw operations like this in QML/3D and
instead focus on higher-level concepts like models and transforms.
Otherwise the app can degenerate into micro-management.
As mentioned, if you want a lot of control, you can add extra items
in a plugin and import them.

What is the use case? Perhaps there is a higher-level concept
we need rather than an explicit "Line3D"? A 3D pointer? A spring
connecting two objects?

Cheers,

Rhys.
Marko Heikkilä
2010-09-16 08:52:57 UTC
Permalink
Hi,

See the below video. My plan is to implement this with QML/3D. It was very easy to draw the circles but the problem is those lines going towards infinity.
http://www.youtube.com/watch?v=Jd3-eiid-Uw&feature=player_embedded

Br,
Marko

> From: rhys.weatherley-***@public.gmane.org
> To: heikkila_marko-***@public.gmane.org; qt-3d-Ihz76zOu8S21Z/+***@public.gmane.org
> Date: Thu, 16 Sep 2010 10:42:13 +0200
> Subject: RE: [Qt-3d] How to draw line with QML/3D
>
> >What is the easiest way to draw a line to 3D space with QML?
> >Lets say that I wan to draw a red line from 3D position A to 3D position B.
>
> At the moment, this isn't possible with QML/3D unless you write
> your own C++ plugin that adds a new QML Line3D element or
> something similar. Another method is to create an external
> .obj file that contains a line (probably a tube made up of triangles)
> and then position and stretch that. That's a bit yucky though.
>
> We generally discourage raw operations like this in QML/3D and
> instead focus on higher-level concepts like models and transforms.
> Otherwise the app can degenerate into micro-management.
> As mentioned, if you want a lot of control, you can add extra items
> in a plugin and import them.
>
> What is the use case? Perhaps there is a higher-level concept
> we need rather than an explicit "Line3D"? A 3D pointer? A spring
> connecting two objects?
>
> Cheers,
>
> Rhys.
r***@public.gmane.org
2010-09-16 10:02:54 UTC
Permalink
>See the below video. My plan is to implement this with QML/3D. It was very easy
>to draw the circles but the problem is those lines going towards infinity.
>http://www.youtube.com/watch?v=Jd3-eiid-Uw&feature=player_embedded

At least the for lines on the walls, I'd probably fake it using quads from a
.obj file and a texture that looks like lines (including the fade effect at the back).
The lines behind the circles are a bit harder. A tube shaped object attached
to the back of the circle? Put the origin of the object at the end of the tube,
and you can use Rotation3D elements to spin them around that point.
That's all I have at the moment. :-)

Cheers,

Rhys.
d***@public.gmane.org
2010-09-16 23:58:46 UTC
Permalink
Though contributions from the community are welcome!

*hint hint*

-----Original Message-----
From: qt-3d-bounces-Ihz76zOu8S21Z/+***@public.gmane.org [mailto:qt-3d-bounces-Ihz76zOu8S21Z/+***@public.gmane.org] On Behalf Of Weatherley Rhys (Nokia-MS-Qt/Brisbane)
Sent: Thursday, September 16, 2010 8:03 PM
To: heikkila_marko-***@public.gmane.org; qt-3d-Ihz76zOu8S21Z/+***@public.gmane.org
Subject: Re: [Qt-3d] How to draw line with QML/3D

>See the below video. My plan is to implement this with QML/3D. It was very easy
>to draw the circles but the problem is those lines going towards infinity.
>http://www.youtube.com/watch?v=Jd3-eiid-Uw&feature=player_embedded

At least the for lines on the walls, I'd probably fake it using quads from a
.obj file and a texture that looks like lines (including the fade effect at the back).
The lines behind the circles are a bit harder. A tube shaped object attached
to the back of the circle? Put the origin of the object at the end of the tube,
and you can use Rotation3D elements to spin them around that point.
That's all I have at the moment. :-)

Cheers,

Rhys.
Loading...