archive-com.com » COM » E » EFG2.COM Total: 878 Choose link from "Titles, links and description words view": Or switch to
"Titles and links view". |

not the most appropriate newsgroup but anyway Given the current newsgroup definitions I d say this is as good as any Any three points in a plane defines a circle unless the points are not in a row Does anyone know an algorithm to find the center of that circle It is quite easy to do by hand but I can t figure out how to do it in Delphi So where are you stuck Sounds like a homework problem Have you looked at these pages http www mineconveyor com geocex7 htm http acm uva es problemset v1 190 html The diagram from the last URL is particular useful So the overall algorithm is this 1 Given points A B and C not collinear 2 Compute midpoint of AB and BC midpoint of AB AX BX 2 AY BY 2 just average the x and y values for the two points 3 Compute the slopes of the lines AB and BC using the two point formula m slope of AB BY AY BX AX you ll have a special case to deal with for a vertical line 4 From 3 compute the slope of a perpendicular line m 1 m

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0410.txt (2016-02-14)

Open archived version from archive

lines kx m in code It s easy to do by hand though Do you know about Kramer s rule 1 Given points A B and C not collinear 2 Compute midpoint of AB and BC midpoint of AB AX BX 2 AY BY 2 just average the x and y values for the two points The result of this is the two midpoints Let s name the midpoint of AB to be D and the midpoint of BC to be E 3 Compute the slopes of the lines AB and BC using the two point formula m slope of AB BY AY BX AX you ll have a special case to deal with for a vertical line So you have an m1 for AB and an m2 for BC 4 From 3 compute the slope of a perpendicular line m 1 m Remember that when the product of the slopes of two lines is 1 the lines are perpendicular Here you have a m1 for AB and an m2 for BC I ve come this far I hope I can implement step 5 7 because that is what I need 5 Using the point slope formula write the equations for the two perpendicular lines y y1 m x x1 Point D and slope m1 y DY m1 x DX Point E and slope m2 y EY m2 x EX DX DY EX EY m1 and m2 are just numbers at this point You have two equations in x and y 6 The solution of the two equations in two unknowns from 5 will give you the center of the circle x y To keep this simple let me rename the constants Do you know about Cramer s Rule two equations in two unknowns It s explained here http www

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0411a.txt (2016-02-14)

Open archived version from archive

I d like to draw the line to join them I ve looked at the TCanvas methods but none of them seem to be ideal I presume I can do it some how with Arc but anybody know how I translate from my three points to the required parameters i use something that i know as a cubic spline curve if someone know a more correct name please let me know it goes something like this procedure DrawCubicCurve Canvas TCanvas const Points array of TPoint Steps cardinal function Interpolate const p1 p2 p3 p4 TPoint t single TPoint function cubic v1 v2 v3 v4 t single single begin result v2 t v1 v3 t 2 v1 2 v2 v3 v4 t v1 v2 v3 v4 end begin Result x round cubic p1 x p2 x p3 x p4 x t Result y round cubic p1 y p2 y p3 y p4 y t end var i s integer p p1 p2 p3 p4 TPoint begin if Length Points 2 then exit Canvas MoveTo Points 0 x Points 0 y p2 Points 0 p3 Points 0 p4 Points 1 for i 0 to High Points 1 do begin p1 p2 p2

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0504c.txt (2016-02-14)

Open archived version from archive

wrote I create an object based off of TGraphicControl and I used the TCanvas Ellipse method to create an ellipse I would like to give the user the ability to rotate this ellipse I would also like to give the user the ability after rotating the ellipse to still adjust the size and shape If anyone has any idea about how to go about doing this I would greatly appreciate

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2002/0205.txt (2016-02-14)

Open archived version from archive

Xref dnews borland public delphi graphics 46149 what s degtorad Kevin wrote in message news 3c622dff 1 2 dnews If anyone has any idea about how to go about doing this I would greatly appreciate it Below No Shape component required Kevin uses Math procedure DrawEllipse ACanvas TCanvas MeanX MeanY Rotation MajorAxis MinorAxis Integer const RotationIncrement 4 var EllipsePoints Array 0 89 of TPoint Total Tics cnt Integer phi Double

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2002/0213.txt (2016-02-14)

Open archived version from archive

b 2 1 This can be drawn in the XY plane Z 0 with a single angular parameter Let s use theta x a cos theta y b sin theta Why does this work If you plug the expressions for x and y back into the ellipse equation you get cos 2 theta sin 2 theta 1 which is a well known trig identity We can draw an ellipsoid as a series of elliptical slices along the z axis from zMin to zMax with some apprpropriate regular interval Start with the ellipsoid formula x 2 a 2 y 2 b 2 z 2 c 2 1 If we know z we can easily get the appropriate XY ellipse equation for the z slice x 2 a 2 y 2 b 2 1 z 2 c 2 But we need this equation to look like the equation at the top x 2 a 2 1 z 2 c 2 y 2 b 2 1 z 2 c 2 1 This means the z slice ellipse equation as a function of theta is x SQRT a 2 1 z 2 c 2 cos theta y SQRT b 2 1 z 2 c 2 sin theta Draw the z slice by varying theta from 0 to 2 PI with some appropriate increment After drawing the z slices from zMin to zMax x slices can be drawn that are perpendicular to the z slices This time we assume we know xMin to xMax for the ellipsoid Start again with the ellipsoid formula x 2 a 2 y 2 b 2 z 2 c 2 1 If we know x we can easily get the appropriate YZ ellipse equation for the x slice y 2 b 2 z 2 c 2 1 x 2 a

Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0327b.txt (2016-02-14)

Open archived version from archive

matrix i k b matrix k j END RESULT matrix i j Defuzz temp END END ELSE EMatrixError Create MultiplyMatrices error END MultiplyMatrices This procedure inverts a general transformation matrix The user need not form an inverse geometric transformation by keeping a product of the inverses of simple geometric transformations translations rotations and scaling A determinant of zero indicates no inverse is possible for a singular matrix FUNCTION InvertMatrix CONST a b TMatrix VAR determinant DOUBLE TMatrix VAR c TMatrix i i pivot TIndex i flag ARRAY TIndex OF BOOLEAN j j pivot TIndex j flag ARRAY TIndex OF BOOLEAN modulus DOUBLE n TIndex pivot DOUBLE pivot col ARRAY TIndex OF TIndex pivot row ARRAY TIndex OF TIndex temporary DOUBLE BEGIN c a The matrix inversion algorithm used here WITH c DO is similar to the maximum pivot strategy BEGIN described in Applied Numerical Methods FOR i 1 TO size DO by Carnahan Luther and Wilkes BEGIN pp 282 284 i flag i TRUE j flag i TRUE END modulus 1 0 i pivot 1 avoid initialization warning j pivot 1 avoid initialization warning FOR n 1 TO size DO BEGIN pivot 0 0 IF ABS modulus 0 0 THEN BEGIN FOR i 1 TO size DO IF i flag i THEN FOR j 1 TO size DO IF j flag j THEN IF ABS matrix i j ABS pivot THEN BEGIN pivot matrix i j largest value on which to pivot i pivot i indices of pivot element j pivot j END IF Defuzz pivot 0 If pivot is too small consider THEN modulus 0 the matrix to be singular ELSE BEGIN pivot row n i pivot pivot col n j pivot i flag i pivot FALSE j flag j pivot FALSE FOR i 1 TO size DO IF i j pivot not in pivot row or column THEN matrix i j matrix i j matrix i pivot j pivot matrix i pivot j matrix i j pivot modulus 2x2 minor modulus FOR j 1 TO size DO IF j 0 THEN BEGIN RESULT size c size The matrix inverse must be unscrambled FOR i 1 TO c size DO if pivoting was not along main diagonal FOR j 1 TO c size DO RESULT matrix pivot row i pivot col j Defuzz c matrix i j determinant END ELSE EMatrixError Create InvertMatrix error END InvertMatrix Transformation Matrices This procedure defines a matrix for a two or three dimensional rotation To avoid possible confusion in the sense of the rotation rotateClockwise or roCounterlcockwise must always be specified along with the axis of rotation Two dimensional rotations are assumed to be about the z axis in the x y plane A rotation about an arbitrary axis can be performed with the following steps 1 Translate the object into a new coordinate system where x y z maps into the origin 0 0 0 2 Perform appropriate rotations about the x and y axes of the coordinate system so that the

Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/GraphicsMathLibrary.PAS.TXT (2016-02-14)

Open archived version from archive

with the wrong direction of the Y axis temp jMax j Canvas Pixels i temp Canvas Pen Color MoveToIJ i temp END PointAtIJ PROCEDURE TPantoGraph RectangleIJ CONST i1 i2 j1 j2 INTEGER BEGIN RectangleIJ asumes i1 j1 is at the lower left and i2 j2 is at the upper right The Canvas Rectangle procedure assumes X1 Y1 at upper left and X2 Y2 at the lower right So X1 Y1 i1 j2 and X2 Y2 i2 j1 Canvas Rectangle i1 jMax j2 i2 jMax j1 END RectangleIJ PROCEDURE TPantoGraph SetColor CONST color TColor BEGIN Canvas Pen Color color END SetColor LineTo MoveTo PointAt PROCEDURE TPantoGraph LineTo CONST v TVector LineTo draws a straight line from the current screen position to a new point and resets the current screen position Transformation of the point can automatically occur see note for MoveTo above Pixels traced over by the line segement are automatically selected Clipping of the line segment to the view boundary can also automatically occur VAR flag BOOLEAN i INTEGER j INTEGER uNew uOld TVector visible BOOLEAN u TVector BEGIN u v because v is CONST IF positioning positionRelative Adjustment for relative positioning THEN BEGIN u AddVectors uSaveW u uSaveW u END u ToCartesian coordinate u VectorTransform u u IF ClipFlag THEN BEGIN uOld uSaveX uNew u clip uOld uNew visible IF visible THEN BEGIN flag uOld x uSaveX y IF uOld Size size3D THEN flag flag OR uOld z iWest AND i jSouth AND j iWest AND i jSouth AND j xEast THEN reg East South West South South East IF u y yNorth THEN reg reg North END size2D size3D BEGIN IF u x u z THEN reg East IF u y u z THEN reg reg North END size3D END CASE END Region PROCEDURE Clip2D This code is used only for clipping two dimensional vectors VAR deltaX DOUBLE deltaY DOUBLE BEGIN deltaX u2 x u1 x x2 x1 deltaY u2 y u1 y y2 y1 IF West IN reg crosses West edge THEN u Vector2D xWest u1 y deltaY xWest u1 x deltaX ELSE IF East IN reg crosses East edge THEN u Vector2D xEast u1 y deltaY xEast u1 x deltaX ELSE IF South IN reg crosses South edge THEN u Vector2D u1 x deltaX ySouth u1 y deltaY ySouth ELSE IF North IN reg crosses North edge THEN u Vector2D u1 x deltaX yNorth u1 y deltaY yNorth END Clip2D PROCEDURE Clip3D This code is used only for clipping three dimensional vectors VAR t z DOUBLE BEGIN IF West IN reg crosses West edge THEN BEGIN t u1 z u1 x u1 x u2 x u2 z u1 z ASSERT t 0 0 AND t 1 0 THEN t 1 0 IF t 0 0 AND t 1 0 THEN t 1 0 ELSE IF t 0 0 AND t 1 0 THEN t 1 0 ELSE IF t 0 0 AND t 1 0 THEN t 1 0 ELSE IF t OR reg2 5 then

Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/GraphicsPrimitivesLibrary.PAS.TXT (2016-02-14)

Open archived version from archive