Lazarus
Home
Forum
Help
TinyPortal
Search
Login
Register
Lazarus
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
BGRABitmap Helix
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
FAQ
Wiki
Bugtracker
Packages
IRC channel
Developer Blog
Follow us on Twitter
Latest SVN
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
Search
Advanced search
« previous
next »
Print
Pages: [
1
]
Author
Topic: BGRABitmap Helix (Read 2914 times)
scons
Full Member
Posts: 123
BGRABitmap Helix
«
on:
February 25, 2017, 12:46:14 pm »
Hi all,
Question:
Can you display a Helix with this module (at least 1 revolution), then divide (put X-number of points) the length of this curve and export this data (length of curve, x-y-z coördinates of start + endpoint + all created points in between) ?
Tricky (maybe) part is to display in runtime the Helix + points in a 3D-view (turntable wise) or seperate 2D-views (front/top/bottom).
I was wondering if this can be done... think so, although not sure.
Thanks
Logged
Windows 10-64bit Lazarus 1.8.2 + FPC 3.0.4
lainz
Hero Member
Posts: 2498
I'm coding :)
Re: BGRABitmap Helix
«
Reply #1 on:
February 25, 2017, 01:09:56 pm »
There's support for SVG and 3D so yes you can, the problem is how.
3D Rotation is supported also.
I don't know how to do it also, but must be possible.
Logged
https://lainz.github.io/
circular
Hero Member
Posts: 2638
Re: BGRABitmap Helix
«
Reply #2 on:
February 25, 2017, 09:29:21 pm »
You can display a 3D object and rotate. However you need to build the object. So you need to formula of a helix, which is rather simple, it is a circle in (x,y) and the coordinate z proportional to the angle. However if you want to display in wireframe, you would need to override the rendering and draw the lines using the projected 2D coordinates.
To see a sample of 3D rendering, I suggest you look at /test/bgratutorial3D folder (in repository or in zip file).
To override the rendering, look for example in ex1.pas. You can override Render or RenderGL (if you want to use OpenGL rendering but that's probably not great because lines are not antialiased).
After calling inherited Render, the vertices will have their coordinates computed so you can use them to draw lines.
In the Create method of the scene, you can see how the 3D object is created. The vertices are of type IBGRAVertex3D. They have a property called ProjectedCoord which contains their 2D coordinates.
Logged
Conscience is the debugger of the mind
scons
Full Member
Posts: 123
Re: BGRABitmap Helix
«
Reply #3 on:
February 26, 2017, 03:25:07 pm »
Oke thanks guys, no I can do a focused search.
Logged
Windows 10-64bit Lazarus 1.8.2 + FPC 3.0.4
scons
Full Member
Posts: 123
Re: BGRABitmap Helix
«
Reply #4 on:
March 01, 2017, 02:05:18 am »
oke, started on the 2D layout and a question popped up:
When I use the openspline function, it draws a closed spline ??
Code: Pascal
[Select]
ctx
.
moveTo
(
0
,
0
)
;
ctx
.
beginPath
;
setlength
(
pts
,
11
)
;
pts
[
0
]
:
=
PointF
(
-
150
,
150
)
;
pts
[
1
]
:
=
PointF
(
-
140
,
110
)
;
pts
[
2
]
:
=
PointF
(
-
110
,
70
)
;
pts
[
3
]
:
=
PointF
(
-
70
,
50
)
;
pts
[
4
]
:
=
PointF
(
-
30
,
20
)
;
pts
[
5
]
:
=
PointF
(
0
,
0
)
;
pts
[
6
]
:
=
PointF
(
30
,
-
20
)
;
pts
[
7
]
:
=
PointF
(
70
,
-
50
)
;
pts
[
8
]
:
=
PointF
(
110
,
-
70
)
;
pts
[
9
]
:
=
PointF
(
140
,
-
110
)
;
pts
[
10
]
:
=
PointF
(
150
,
-
150
)
;
ctx
.
openedSpline
(
pts
,
ssInside
)
;
ctx
.
closePath
;
ctx
.
stroke
(
)
;
What am I doing wrong ? I want to get rid of the straight line in the front view that connect the start and endpoint of the spline.
I can not seem to find much info about this spline draw function.
Thanks
Logged
Windows 10-64bit Lazarus 1.8.2 + FPC 3.0.4
scons
Full Member
Posts: 123
Re: BGRABitmap Helix
«
Reply #5 on:
March 01, 2017, 11:17:02 am »
Oke, don't know if it is correct but this did the trick:
slice
Code: Pascal
[Select]
ctx
.
openedSpline
(
slice
(
pts
,
11
)
,
ssCrossing
)
;
Logged
Windows 10-64bit Lazarus 1.8.2 + FPC 3.0.4
circular
Hero Member
Posts: 2638
Re: BGRABitmap Helix
«
Reply #6 on:
March 01, 2017, 11:31:36 am »
Hmmm I suppose it is rather because of closePath. This asks to draw a line from the current point to the beggining of the path. Otherwise you don't need to call closePath.
But you still need to call beginPath to clear the content of the path when you start a new path.
Logged
Conscience is the debugger of the mind
scons
Full Member
Posts: 123
Re: BGRABitmap Helix
«
Reply #7 on:
March 01, 2017, 11:38:54 am »
Hah you're right, removing the closePath also opens it. I was looking for a solution in the wrong direction.
Thanks
Logged
Windows 10-64bit Lazarus 1.8.2 + FPC 3.0.4
circular
Hero Member
Posts: 2638
Re: BGRABitmap Helix
«
Reply #8 on:
March 02, 2017, 06:44:43 pm »
You're welcome
Logged
Conscience is the debugger of the mind
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
BGRABitmap Helix
Recent
CAD program written in La...
by
benohb
[
Today
at 04:26:18 am]
free pascal (none-lazarus...
by
dbannon
[
Today
at 03:28:31 am]
macOS 32-bit app warning
by
dbannon
[
Today
at 03:15:36 am]
Sizable TPanel
by
jamie
[
Today
at 03:14:55 am]
different selections to i...
by
jamie
[
Today
at 02:53:23 am]
Visual Pascal Community E...
by
valdir.marcos
[
Today
at 02:03:05 am]
How do I get the PLAN fro...
by
RedOctober
[
Today
at 01:39:22 am]
Import excel to dbgird
by
wp
[
Today
at 01:13:02 am]
[SOLVED] What am I doing ...
by
cpicanco
[
Today
at 01:12:43 am]
What does this TGtk2Widge...
by
cpicanco
[
Today
at 01:00:28 am]