Search found 38 matches

by alter Mann
Fri Apr 24, 2020 7:46 pm
Forum: Windows
Topic: How to Apply NeHe gluUnProject example to OpenGL Gadget?
Replies: 4
Views: 2971

Re: How to Apply NeHe gluUnProject example to OpenGL Gadget?

the problem is
glPushMatrix_()
and
glPopMatrix_()
before getting the ModelViewMatrix.
Therefore the matrix is always the same.

I've changed you code a little bit :wink: with a long time for changing the view
Enumeration
#Win
#Ogl
#Timer
EndEnumeration

Procedure DrawCube ...
by alter Mann
Fri Apr 24, 2020 4:09 pm
Forum: Windows
Topic: How to Apply NeHe gluUnProject example to OpenGL Gadget?
Replies: 4
Views: 2971

Re: How to Apply NeHe gluUnProject example to OpenGL Gadget?

glReadPixels_(dWinX, dWinY, 1, 1, #GL_DEPTH_COMPONENT, #GL_DOUBLE, @dWinZ) ;surely always 0.0?
only returns a float value
It should be

Code: Select all

Protected dWinX.f, dWinY.f, dWinZ.f
glReadPixels_(dWinX, dWinY, 1, 1, #GL_DEPTH_COMPONENT, #GL_FLOAT, @dWinZ) ;surely always 0.0?
by alter Mann
Fri Mar 06, 2020 9:24 am
Forum: 3D Programming
Topic: OpenGl 3D Line Style
Replies: 2
Views: 2410

Re: OpenGl 3D Line Style

GL_INVALID_OPERATION is generated if glLineStipple is executed between the execution of glBegin and the corresponding execution of glEnd.
by alter Mann
Fri Feb 21, 2020 12:22 pm
Forum: Coding Questions
Topic: Converting a short piece of C/C++ code
Replies: 19
Views: 3766

Re: Converting a short piece of C/C++ code

f you are sure that the lines are not parallel, you can shorten the code:


Procedure.d VecSpat (Array adU.d(1), Array adV.d(1), Array adW.d(1))
ProcedureReturn adU(0)*adV(1)*adW(2)+adV(0)*adW(1)*adU(2)+adW(0)*adU(1)*adV(2) - adU(0)*adW(1)*adV(2)-adV(0)*adU(1)*adW(2)-adW(0)*adV(1)*adU(2 ...
by alter Mann
Fri Feb 21, 2020 9:35 am
Forum: Coding Questions
Topic: Converting a short piece of C/C++ code
Replies: 19
Views: 3766

Re: Converting a short piece of C/C++ code

Try this:

Procedure DistancePointLine ( Array adQ.d(1), Array adP.d(1), Array adV.d(1), *dU.double, *dA.double)
Protected Dim adU.d(2)
Protected Dim adN.d(2)
Protected dL

dL = adV(0)*adV(0) + adV(1)*adV(1) + adV(2)*adV(2)
*dA\d = 1.0e20
*dU\d = 0.0

adU(0) = adQ(0) - adP(0)
adU(1) = adQ ...
by alter Mann
Wed Feb 19, 2020 9:54 pm
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

The point set does not define one direction of the plane but both, the calculated direction (adV()) and the opposite direchtion (-adV(0),-adV(1),-adV(2)). To choose one of both you need additional information.
by alter Mann
Mon Feb 17, 2020 8:41 pm
Forum: Coding Questions
Topic: Converting a short piece of C/C++ code
Replies: 19
Views: 3766

Re: Converting a short piece of C/C++ code

I would calculate the intersection line like this:

EnableExplicit

#DBL_EPSILON = 0.0001

Structure pt3d
x.d
y.d
z.d
EndStructure

Structure ln3d
pt1.pt3d
pt2.pt3d
EndStructure

Structure vector3d
x.d
y.d
z.d
EndStructure

Structure plane3d
VecNorm.vector3d
PtV0.pt3d
EndStructure

Procedure ...
by alter Mann
Sun Jan 19, 2020 11:28 am
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

adMinMax ist the bounding box. adSP is the centroid of all data points. This is not the same as the centroid of the bouning box. The centroid is part of the best-fit plane (see the article you linked above).
adMP is the centroid of the bounding box.
CalcMat calculates the matrix, according to which ...
by alter Mann
Thu Jan 16, 2020 5:37 pm
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

If you have questions about triangles, lines, points, etc., don't hesitate to ask. I have been working on such problems for years. :)
by alter Mann
Thu Jan 16, 2020 9:30 am
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

I've added some comments (not for calculation of eigenvectors - this is numerical math). Maybe it makes something clearer, maybe it confuse you more :mrgreen:. (I'm not native in this language)
by alter Mann
Wed Jan 15, 2020 5:36 pm
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

I played a little bit and added zoom,center and identification functions (code above).
Hope you enjoy :)
by alter Mann
Wed Jan 15, 2020 9:30 am
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

Yes, a lot of code for such a "simple" problem :wink: .

I've changed the code above. It was a simple glOrtho problem. The result was correct but you couldn't see it. And I forgot a CloseFile.
by alter Mann
Tue Jan 14, 2020 12:57 pm
Forum: 3D Programming
Topic: Procedure to define a best-fit Plane through a set of points
Replies: 22
Views: 9504

Re: Procedure to define a best-fit Plane through a set of po

It took a lot of time to convert old C-code (for calculating eigenvalues and eigenvectors) to PB.

I've put your point data into a file.

For your example the code works.


EnableExplicit

#PB_DBL_MAX = 1.7976931348623158e+308 ; max double value

#PB_DBL_EPS = 2.2204460492503131e-016 ; smallest ...
by alter Mann
Mon Mar 04, 2019 7:34 pm
Forum: Coding Questions
Topic: [Solved] Curve Fits more accurate than Cubic Spline ?
Replies: 16
Views: 4203

Re: Curve Fits more accurate than Cubic Spline ?

How do you choose the x-values, where the splines should start and end?
by alter Mann
Thu Feb 07, 2019 10:20 am
Forum: General Discussion
Topic: Langmuir Model Curve Fit equation
Replies: 7
Views: 2510

Re: Langmuir Model Curve Fit equation

Unfortunately, I deleted all the comments because they were all in German. Therefore here are some explanations:
The code can also be used for other approximations. For this purpose, the functions LangmuirFkt and LangmuirAbl must be replaced and the array dC () must be adapted to the number of ...