VS:NurbsSurfaceEvalPt/ja

From Vectorworks Developer
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

ハンドルで指定したNURBS曲面上の結び目u,vの座標を返します。

PROCEDURE NurbsSurfaceEvalPt(
objectHd :HANDLE;
u :REAL;
v :REAL;
VAR p :POINT3D);
def vs.NurbsSurfaceEvalPt(objectHd, u, v):
    return p

Parameters

objectHd HANDLE NURBS曲面のハンドル
u REAL U方向上の結び目の値
v REAL V方向上の結び目の値
p POINT3D 結び目の座標

Example

PROCEDURE LocusSurface;
{ Create a surface, then put loci on it }
CONST
    uMaxIndex   = 16;   { 17 points, 0 - 16 }
    vMaxIndex   = 16;   { 17 points, 0 - 16 }
    uDegree     = 3;    
    vDegree     = 4;
    xMin        = -3;
    xMax        = 3;
    yMin        = -3;
    yMax        = 3;
    zMax        = 3;
    numLoci     = 17;
VAR
    surfaceH                : HANDLE;
    x,y,z,u,v               : REAL;
    i,j                     : INTEGER;
    numKnotsU, numKnotsV    : INTEGER;
    maxFoundU, maxFoundV    : REAL;
    uStep, vStep            : REAL;
BEGIN
    { Create a Nurbs Surface }
    
    surfaceH := CreateNurbsSurface(uMaxIndex + 1, vMaxIndex + 1, uDegree, vDegree);
    IF surfaceH <> NIL THEN BEGIN
        FOR i := 0 TO uMaxIndex  DO BEGIN
            FOR j := 0 TO vMaxIndex DO BEGIN
                x := xMin + (xMax - xMin) * (i / uMaxIndex);
                y := yMin + (yMax - yMin) * (j / vMaxIndex);
                z := Cos(i - uMaxIndex / 2) *
                     Cos(j - vMaxIndex / 2) * 
                     zMax / (1 + x*x + y*y);
                NurbsSetPt3D(surfaceH, i, j, x,y,z);
            END;
        END;
        ResetBBox(surfaceH);
        
        { Add Loci }
        
        { Find number of knots in each direction }
        numKnotsU := NurbsNumKnots(surfaceH, 1);
        numKnotsV := NurbsNumKnots(surfaceH, 0);
        
        { Find the u and v real values that correspond the knots with the 
          maximum u and v indices. }
        NurbsKnot(surfaceH, 1, numKnotsU - 1, maxFoundU);       
        NurbsKnot(surfaceH, 0, numKnotsV - 1, maxFoundV);       
        
        Message(numKnotsU, ' ', numKnotsV);
        
        { Create 3D loci along each direction }
        uStep   := maxFoundU / (numLoci - 1);
        vStep   := maxFoundV / (numLoci - 1);
        
        u := 0;
        WHILE u <= maxFoundU DO BEGIN
            v := 0;
            WHILE v <= maxFoundV DO BEGIN
                NurbsSurfaceEvalPt(surfaceH, u, v, x,y,z);
                Locus3D(x,y,z);
                v := v + vStep;
            END;
            u := u + uStep;
        END;
    
        { Set View }
        Projection(0,0,9.76,-4.88,4.88,4.88,-4.88);
        SetView(#-45.0d,#-35.26438968275d,#-30.0d,0,0,0);
        RedrawAll;
    END;
END;
Run(LocusSurface);

Version

利用可能バージョン: VectorWorks9.5

See Also

関連関数:

VS:NurbsKnot | VS:NurbsNumKnots

関連関数:

[[VS:NurbsKnot]]

| [[VS:NurbsNumKnots]]