Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Visual Aid

    SDK Help
    0
    46
    33.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 25/08/2009 at 14:55, xxxxxxxx wrote:

      Create a rotation matrix and apply it before applying the global matrix to the vectors. MatrixRotX(), MatrixRotY(), MatrixRotZ() are what you need to look for. If you are going to use the vector values from GetRot(), simply use HPBToMatrix(). I see that it now has specific rotation orders as well (this is new in R11!). I would stick with ROT_HPB in this situation. 🙂

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 25/08/2009 at 17:34, xxxxxxxx wrote:

        This is what I do to get my global matrix to maintain the position of the polygon.

        > `

          
        \>  Matrix matrix = op->GetMg(); // Get the global matrix  
        \>  Vector globalPos = matrix.off; // Get the position from the matrix  
        \>  
        

        `

        Then in the vectors I put...
        > `

          
        \>  Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z),Vector(-lngMaxX-100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z)};   
        \>  
        

        `

        lngMaxX, lngMaxY, and lngMaxZ are the greatest point on each of those axis.

        So to create the rotation matrix I would do this?
        > `

          
        \>  Vector rot = op->GetRot();  
        \>  Matrix rotation = HPBToMatrix(rot, ROT_HPB);  
        \>  
        

        `

        Then what do I add to my vectors?

        Thanks,

        ~Shawn

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 25/08/2009 at 19:25, xxxxxxxx wrote:

          Vector p[4] = ???;
          p[4] = p[4] * rotation;

          You'll have to initialize the vectors to the plane point values first (???).

          You can't 'add' rotations to a point. It must be a matrix multiplication.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 25/08/2009 at 19:37, xxxxxxxx wrote:

            Okay I have this to declare necessary variables and set up matrices

            > `

              
            \>       //Used to lock the poistion of the visualized symmetry plane to the object   
            \>       Matrix matrix = op->GetMg(); // Get the global matrix  
            \>      Vector globalPos = matrix.off; // Get the position from the matrix  
            \>         
            \>       Matrix m = op->GetMg();  
            \>       Vector rot = op->GetRot();  
            \>       GePrint ("The Rotation Coordinates are... " + RealToString(rot.x) + RealToString(rot.y) + RealToString(rot.z));  
            \>       Matrix rotation = HPBToMatrix(rot, ROT_HPB);  
            \>  
            

            `

            And this is where it all gets it's values.

            > `

              
            \>            Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z),Vector(-lngMaxX-100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z)};  
            \>            p[4] = p[4] * rotation;  
            \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
            \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
            \>            bd->SetTransparency(trans);  
            \>            bd->Polygon3D(p,f,TRUE);  
            \>    
            \>  
            

            `

            As it is , when I added p[4] = p[4] * rotation;

            It crashes.

            Do you see anything wrong?

            Thanks,

            ~Shawn

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 25/08/2009 at 20:40, xxxxxxxx wrote:

              You have four vectors there. p[4] is an invalid index. Sorry if my pseudo-code was confusing. You need to matrix multiply each individual vector:

              p[0] = p[0] * rotation;
              p[1] = p[1] * rotation;
              p[2] = p[2] * rotation;
              p[3] = p[3] * rotation;

              You should also be doing the matrix multiplication before the other stuff though. This is why I put in ??? instead of that complex position math. 🙂 Typical order of applying transformations is scale->rotation->position. This keeps the scale and rotation with respect to the object's origin.

              It looks like you are using +100 and -100 as the initial plane vector values. Start with the defaults, multiply by the rotation matrix and thenadd in the other values.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 25/08/2009 at 21:12, xxxxxxxx wrote:

                I should add that you might get better results if you simply multiply the plane vectors by the global matrix:

                p[0] = p[0] * m;
                p[1] = p[1] * m;
                p[2] = p[2] * m;
                p[3] = p[3] * m;

                And then adjust the positions from there (minus the global positions which are part of the matrix). This would remove a lot of complications as the global matrix multiplication puts the plane into the 'space' of the object. Then you can adjust relative to that. I hope that is clear. 🙂

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 25/08/2009 at 21:27, xxxxxxxx wrote:

                  So the first thing I would do would be to perform these multiplications.

                  > `

                    
                  \>  p[0] = p[0] * m;  
                  \>  p[1] = p[1] * m;  
                  \>  p[2] = p[2] * m;  
                  \>  p[3] = p[3] * m;  
                  \>  
                  

                  `

                  Then perform these calculations?
                  > `

                    
                  \>  Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z),Vector(-lngMaxX-100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z)};  
                  \>  
                  

                  `

                  lngMaxX, lngMaxY, and lngMaxZ are the greatest points at those axes, these are determine using a for loop which cycles through until it finds the greates point on that plane.

                  So I would do the multiplication, then add/subtract the variables in the vectors?

                  So final code should look like this?
                  > `

                    
                  \>  p[0] = p[0] * m;  
                  \>  p[1] = p[1] * m;  
                  \>  p[2] = p[2] * m;  
                  \>  p[3] = p[3] * m;  
                  \>    
                  \>    
                  \>  Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z),Vector(-lngMaxX-100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,lngMaxY+100+globalPos.y,0+globalPos.z),Vector(lngMaxX+100+globalPos.x,-lngMaxY-100+globalPos.y,0+globalPos.z)};  
                  \>  
                  

                  `

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 25/08/2009 at 21:57, xxxxxxxx wrote:

                    Okay, I must be doing something wrong. This is the code under the whole draw() function.    I am only altering the XY plane right now found under "case XY_PLANE:", the other 2 are using the old code.

                    With the new code, everything works except rotation. it scales properly, it translates properly, it just doesn't rotate at all.

                    Do you see anything wrong?

                    Thanks,

                    ~Shawn

                    > `

                      
                    \>    
                    \>  Bool TrueSymmetry::Draw(PluginTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)  
                    \>  {  
                    \>    
                    \>       BaseContainer *bc=((BaseList2D* )tag)->GetDataInstance();  
                    \>       LONG lngMySymPlane =tag->GetDataInstance()->GetLong (SYMMETRY_PLANE);  
                    \>       LONG trans = 175;  
                    \>       Vector color = bc->GetVector(PLANE_COLOR);  
                    \>         
                    \>    
                    \>       //Used to lock the poistion of the visualized symmetry plane to the object   
                    \>       Matrix matrix = op->GetMg(); // Get the global matrix  
                    \>      Vector globalPos = matrix.off; // Get the position from the matrix  
                    \>         
                    \>       Matrix m = op->GetMg();  
                    \>       Vector rot = op->GetRot();  
                    \>       GePrint ("The Rotation Coordinates are... " + RealToString(rot.x) + RealToString(rot.y) + RealToString(rot.z));  
                    \>       Matrix rotation = HPBToMatrix(rot, ROT_HPB);  
                    \>         
                    \>       //For resizing the plane  
                    \>       PolygonObject* objPoly;  
                    \>       objPoly=(PolygonObject* )op;  
                    \>       Vector * arrPoint;  
                    \>       arrPoint=objPoly->GetPointW();  
                    \>       LONG lngI;  
                    \>       LONG lngPointCount=objPoly->GetPointCount();  
                    \>       LONG lngMaxX=0;  
                    \>       LONG lngMaxY=0;  
                    \>       LONG lngMaxZ=0;  
                    \>    
                    \>       //Determine the largest x,y,and z values for the object  
                    \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                    \>       { if (arrPoint[lngI].x>lngMaxX)  
                    \>       { lngMaxX=arrPoint[lngI].x;}  
                    \>       }  
                    \>    
                    \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                    \>       { if (arrPoint[lngI].y>lngMaxY)  
                    \>       { lngMaxY=arrPoint[lngI].y;}  
                    \>       }  
                    \>    
                    \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                    \>       { if (arrPoint[lngI].z>lngMaxZ)  
                    \>       { lngMaxZ=arrPoint[lngI].z;}  
                    \>       }  
                    \>    
                    \>  // lngMaxX, ingMaxY, and ingMaxZ now hold the largest x,y, and z values of the mesh.  
                    \>    
                    \>       switch (lngMySymPlane)  
                    \>       {  
                    \>    
                    \>            case XY_PLANE:  
                    \>              
                    \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                    \>            {  
                    \>            Vector p[4];  
                    \>            p[0] = p[0] * m;  
                    \>            p[1] = p[1] * m;  
                    \>            p[2] = p[2] * m;  
                    \>            p[3] = p[3] * m;  
                    \>            p[0] = p[0] + Vector(-lngMaxX-100,-lngMaxY-100,0);  
                    \>            p[1] = p[1]     + Vector(-lngMaxX-100,lngMaxY+100,0);  
                    \>            p[2] = p[2]     + Vector(lngMaxX+100,lngMaxY+100,0);  
                    \>            p[3] = p[3]     + Vector(lngMaxX+100,-lngMaxY-100,0);  
                    \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                    \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                    \>            bd->SetTransparency(trans);  
                    \>            bd->Polygon3D(p,f,TRUE);  
                    \>    
                    \>            return true;  
                    \>            }  
                    \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                    \>            {  
                    \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            bd->Polygon3D(p,f,FALSE);  
                    \>            }  
                    \>    
                    \>           return DRAW_HANDLES|DRAW_AXIS;  
                    \>            break;  
                    \>    
                    \>            case YZ_PLANE:  
                    \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                    \>            {  
                    \>            Vector p[4] = { Vector(0+globalPos.x,-lngMaxY-100+globalPos.y,-lngMaxZ-100+globalPos.z),Vector(0+globalPos.x,-lngMaxY-100+globalPos.y,lngMaxZ+100+globalPos.z),Vector(0+globalPos.x,lngMaxY+100+globalPos.y,lngMaxZ+100+globalPos.z),Vector(0+globalPos.x,lngMaxY+100+globalPos.y,-lngMaxZ-100+globalPos.z)};  
                    \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                    \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                    \>            bd->SetTransparency(trans);  
                    \>            bd->Polygon3D(p,f,TRUE);  
                    \>            return true;  
                    \>            }  
                    \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                    \>            {  
                    \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            bd->Polygon3D(p,f,FALSE);  
                    \>            }  
                    \>    
                    \>           return DRAW_HANDLES|DRAW_AXIS;  
                    \>            break;  
                    \>    
                    \>            case XZ_PLANE:  
                    \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                    \>            {  
                    \>            Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,0+globalPos.y,-lngMaxZ-100+globalPos.z),Vector(-lngMaxX-100+globalPos.x,0+globalPos.y,lngMaxZ+100+globalPos.z),Vector(lngMaxX+100+globalPos.x,0+globalPos.y,lngMaxZ+100+globalPos.z),Vector(lngMaxX+100+globalPos.x,0+globalPos.y,-lngMaxZ-100+globalPos.z)};  
                    \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                    \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                    \>            bd->SetTransparency(trans);  
                    \>            bd->Polygon3D(p,f,TRUE);  
                    \>            return true;  
                    \>            }  
                    \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                    \>            {  
                    \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                    \>            bd->Polygon3D(p,f,FALSE);  
                    \>            }  
                    \>    
                    \>           return DRAW_HANDLES|DRAW_AXIS;  
                    \>            break;  
                    \>       }  
                    \>  }  
                    \>    
                    \>    
                    \>  
                    

                    `

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 25/08/2009 at 22:29, xxxxxxxx wrote:

                      1. Instead of determining the bounding box yourself, use GetMp() and GetRad(). 😉

                      2. Of course, with use of only 'm', you don't need the HPBToMatrix() and globalPos. 🙂

                      3. To size the plane polygon, don't add values, multiply by the vector returned in GetRad(). Start your plane polygon at size of 1x1x1 so as to be centered at the origin (Vector(0.5, 0.0 0.5) etc.). The matrix 'm' will put it into the object's space. GetRad() will scale it to be as big as the object's bounding box.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 26/08/2009 at 07:06, xxxxxxxx wrote:

                        okay this is what I have now..   Now it creates a thin line coming out of the corner of the object.

                        Do you see a problem?

                        ~Shawn

                        > <code>
                        >
                        >> `

                          
                        \>    
                        \>  Bool TrueSymmetry::Draw(PluginTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)  
                        \>  {  
                        \>    
                        \>       BaseContainer *bc=((BaseList2D* )tag)->GetDataInstance();  
                        \>       LONG lngMySymPlane =tag->GetDataInstance()->GetLong (SYMMETRY_PLANE);  
                        \>       LONG trans = 175;  
                        \>       Vector color = bc->GetVector(PLANE_COLOR);  
                        \>         
                        \>    
                        \>       //Used to lock the poistion of the visualized symmetry plane to the object   
                        \>       Matrix matrix = op->GetMg(); // Get the global matrix  
                        \>      Vector globalPos = matrix.off; // Get the position from the matrix  
                        \>         
                        \>       Matrix m = op->GetMg();  
                        \>       Vector rot = op->GetRot();  
                        \>       Vector rad = op->GetRad();  
                        \>    
                        \>       GePrint ("The Rotation Coordinates are... " + RealToString(rot.x) + RealToString(rot.y) + RealToString(rot.z));  
                        \>         
                        \>       //For resizing the plane  
                        \>       PolygonObject* objPoly;  
                        \>       objPoly=(PolygonObject* )op;  
                        \>       Vector * arrPoint;  
                        \>       arrPoint=objPoly->GetPointW();  
                        \>       LONG lngI;  
                        \>       LONG lngPointCount=objPoly->GetPointCount();  
                        \>       LONG lngMaxX=0;  
                        \>       LONG lngMaxY=0;  
                        \>       LONG lngMaxZ=0;  
                        \>    
                        \>       //Determine the largest x,y,and z values for the object  
                        \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                        \>       { if (arrPoint[lngI].x>lngMaxX)  
                        \>       { lngMaxX=arrPoint[lngI].x;}  
                        \>       }  
                        \>    
                        \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                        \>       { if (arrPoint[lngI].y>lngMaxY)  
                        \>       { lngMaxY=arrPoint[lngI].y;}  
                        \>       }  
                        \>    
                        \>       for (lngI=0;lngI<lngPointCount;lngI++)  
                        \>       { if (arrPoint[lngI].z>lngMaxZ)  
                        \>       { lngMaxZ=arrPoint[lngI].z;}  
                        \>       }  
                        \>    
                        \>  // lngMaxX, ingMaxY, and ingMaxZ now hold the largest x,y, and z values of the mesh.  
                        \>    
                        \>       switch (lngMySymPlane)  
                        \>       {  
                        \>    
                        \>            case XY_PLANE:  
                        \>              
                        \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                        \>            {  
                        \>            Vector p[4];  
                        \>            p[0] = Vector(-1,-1,0);  
                        \>            p[1] = Vector(1,-1,0);  
                        \>            p[2] = Vector(1,1,0);  
                        \>            p[3] = Vector(1,-1,0);  
                        \>    
                        \>            p[0] = p[0] * m;  
                        \>            p[1] = p[1] * m;  
                        \>            p[2] = p[2] * m;  
                        \>            p[3] = p[3] * m;  
                        \>    
                        \>            p[0] = p[0] * rad +100;  
                        \>            p[1] = p[1] * rad +100;  
                        \>            p[2] = p[2] * rad +100;  
                        \>            p[3] = p[3] * rad +100;  
                        \>    
                        \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                        \>    
                        \>            /*  
                        \>            p[0] = p[0] + Vector(-lngMaxX-100,-lngMaxY-100,0);  
                        \>            p[1] = p[1]     + Vector(-lngMaxX-100,lngMaxY+100,0);  
                        \>            p[2] = p[2]     + Vector(lngMaxX+100,lngMaxY+100,0);  
                        \>            p[3] = p[3]     + Vector(lngMaxX+100,-lngMaxY-100,0);  
                        \>    
                        \>            */  
                        \>    
                        \>              
                        \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                        \>            bd->SetTransparency(trans);  
                        \>            bd->Polygon3D(p,f,TRUE);  
                        \>    
                        \>            return true;  
                        \>            }  
                        \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                        \>            {  
                        \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            bd->Polygon3D(p,f,FALSE);  
                        \>            }  
                        \>    
                        \>           return DRAW_HANDLES|DRAW_AXIS;  
                        \>            break;  
                        \>    
                        \>            case YZ_PLANE:  
                        \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                        \>            {  
                        \>            Vector p[4] = { Vector(0+globalPos.x,-lngMaxY-100+globalPos.y,-lngMaxZ-100+globalPos.z),Vector(0+globalPos.x,-lngMaxY-100+globalPos.y,lngMaxZ+100+globalPos.z),Vector(0+globalPos.x,lngMaxY+100+globalPos.y,lngMaxZ+100+globalPos.z),Vector(0+globalPos.x,lngMaxY+100+globalPos.y,-lngMaxZ-100+globalPos.z)};  
                        \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                        \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                        \>            bd->SetTransparency(trans);  
                        \>            bd->Polygon3D(p,f,TRUE);  
                        \>            return true;  
                        \>            }  
                        \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                        \>            {  
                        \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            bd->Polygon3D(p,f,FALSE);  
                        \>            }  
                        \>    
                        \>           return DRAW_HANDLES|DRAW_AXIS;  
                        \>            break;  
                        \>    
                        \>            case XZ_PLANE:  
                        \>            if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
                        \>            {  
                        \>            Vector p[4] = { Vector(-lngMaxX-100+globalPos.x,0+globalPos.y,-lngMaxZ-100+globalPos.z),Vector(-lngMaxX-100+globalPos.x,0+globalPos.y,lngMaxZ+100+globalPos.z),Vector(lngMaxX+100+globalPos.x,0+globalPos.y,lngMaxZ+100+globalPos.z),Vector(lngMaxX+100+globalPos.x,0+globalPos.y,-lngMaxZ-100+globalPos.z)};  
                        \>            Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
                        \>            bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
                        \>            bd->SetTransparency(trans);  
                        \>            bd->Polygon3D(p,f,TRUE);  
                        \>            return true;  
                        \>            }  
                        \>            else //If SHOW_PLANE is unchecked, say goodbye to the polygon.  
                        \>            {  
                        \>            Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};  
                        \>            bd->Polygon3D(p,f,FALSE);  
                        \>            }  
                        \>    
                        \>           return DRAW_HANDLES|DRAW_AXIS;  
                        \>            break;  
                        \>       }  
                        \>  }  
                        \>    
                        \>  
                        

                        `
                        >
                        > </code>

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 26/08/2009 at 08:47, xxxxxxxx wrote:

                          Solved the problem....

                          Ended up doing this....

                          > `

                            
                          \>       Matrix m = op->GetMg();  
                          \>       Vector rad = op->GetRad();  
                          \>    
                          \>       m.v1 *= rad.x+100;  
                          \>       m.v2 *= rad.y+100;  
                          \>       m.v3 *= rad.z+100;  
                          \>  
                          

                          `

                          Then doing this to set the values of the vectors for polygon3D()

                          > `

                            
                          \>            Vector p[4];  
                          \>    
                          \>            p[0] = Vector(-1,-1,0);  
                          \>            p[1] = Vector(-1,1,0);  
                          \>            p[2] = Vector(1,1,0);  
                          \>            p[3] = Vector(1,-1,0);  
                          \>    
                          \>            p[0] = p[0] * m;  
                          \>            p[1] = p[1] * m;  
                          \>            p[2] = p[2] * m;  
                          \>            p[3] = p[3] * m;  
                          \>  
                          

                          `

                          Thanks for your help Robert and Matthias.

                          ~Shawn

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post