Article | 41023378 |
Type | HowTo |
Product | Engine |
Version | 4.1.6.1028 |
Date Added | 1/13/2004 |
Submitted by | Mario Pellegrino |
Keywords |
RetVal = vdraw.Utility.geom3PointCenter(PuntoIniArco, PuntoIntermedio, PuntoFinArco, CentroTmp)
with points in the plane XY
PuntoIniArco= (449,524,0)
PuntoIntermedio=(595,2083,0)
PuntoFinArco=(636,2089,0)
CentroTmp is correct (909,1267,0)
while with points in plane XZ
PuntoIniArco= (449,0,524)
PuntoIntermedio=(595,0,2083)
PuntoFinArco=(636,0,2089)
CentroTmp is not computed correct!!!!!
See the Visual Basic 6 sample code below:
Dim PuntoIniArco As Variant Dim PuntoIntermedio As Variant Dim PuntoFinArco As Variant Dim retval As Variant Dim CentroTmp As Variant Dim extrusion As Variant Dim matrix As vdmatrix Dim pt As vdxyz PuntoIniArco = Array(449, 0, 524) 'the points are in WCS PuntoIntermedio = Array(595, 0, 2083) 'the points are in WCS PuntoFinArco = Array(636, 0, 2089) 'the points are in WCS extrusion = VDPro1.Utility.GetExtrusionVector(PuntoIniArco, PuntoIntermedio, PuntoFinArco) Set matrix = VDPro1.CreateInstance(OBJ_MATRIX) 'where ecs is the coordinate system that defined from three points of arc matrix.ExtrudeMatrix extrusion(0), extrusion(1), extrusion(2) 'create a matrix to transform from ECS to WCS matrix.Inverse 'set the matrix to transform from wcs to ecs Set pt = VDPro1.CreateInstance(OBJ_XYZ) pt.Value = PuntoIniArco pt.Transformby matrix PuntoIniArco = pt.Value 'the point now is in ECS pt.Value = PuntoIntermedio pt.Transformby matrix PuntoIntermedio = pt.Value 'the point now is in ECS pt.Value = PuntoFinArco pt.Transformby matrix PuntoFinArco = pt.Value 'the point now is in ECS retval = VDPro1.Utility.geom3PointCenter(PuntoIniArco, PuntoIntermedio, PuntoFinArco, CentroTmp) 'the center is in ECS so we have to transform it to WCS pt.Value = CentroTmp matrix.Inverse 'set the matrix to transform from ECS to WCS pt.Transformby matrix CentroTmp = pt.Value MsgBox CStr(CentroTmp(0)) + " " + CStr(CentroTmp(1)) + " " + CStr(CentroTmp(2))