Author Topic: Matrix3d and TransformBy help  (Read 56327 times)

0 Members and 1 Guest are viewing this topic.

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #60 on: August 02, 2008, 01:38:14 PM »
I had moved the solid so I could see the points  :-o
Have a look at these two objects, they are the same size, but the min max results are different

Daniel,

I think I understand what you are saying :)

Maybe I did not explain myself on the min-max points the arx command is extracting.

I'll try again.-

For now the function returns two points on the solid let's named min & max. (if you draw a line between those two points and compare it it will be the same length)

What I am doing as the next phase, is to get the two bases of the solid, base on those two points, as soon I finished, will upload the command.

Maybe I am totally wrong.... but I am having fun :)

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #61 on: August 02, 2008, 01:54:35 PM »
You’re right, that’s what I did with my C# routine, it starts to get more complex as the solid become more complex,
for example when there are no 90* angles on the solid.   :laugh:

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #62 on: August 02, 2008, 02:02:09 PM »
You’re right, that’s what I did with my C# routine, it starts to get more complex as the solid become more complex,
for example when there are no 90* angles on the solid.   :laugh:

Yes, and for now I do not have any intention to get into to deep.




Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #63 on: August 03, 2008, 10:57:37 AM »
You’re right, that’s what I did with my C# routine, it starts to get more complex as the solid become more complex,
for example when there are no 90* angles on the solid.   :laugh:

I end up using the UCS command with Face option, and all the points are not shown right.

Here is the file again with the correction, still it computes just two points (rectangular faces only).

Note: WIP

PS> Cannot test your C# routine, no A2009 here...

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #64 on: August 03, 2008, 02:48:26 PM »
You’re right, that’s what I did with my C# routine, it starts to get more complex as the solid become more complex,
for example when there are no 90* angles on the solid.   :laugh:

Dan, try something like this (pseudo code) -

Find the longest edge
get a face this edge belong to //(there are 2 choices, it doesn't matter at this stage)

// the zvec of the xfrom
vecz = edge.ep - edge.sp
vecz.normalise

// the y vec of the xform, as the face normal is perp to the face it's also perp to the edge ;)
vecy = face.normal()

// now create the x vec for the xform
vecx = vecz.crossproduct(vecy)

// if you need to xlate it as well, get the vector to the sp (start point) of the edge

vectrans = edge.sp.asVector()


Now all you need to do is build your matrices and do the work, invert them to xform back if required. The length will be bbox max.z - minz
hth


   

"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #65 on: August 03, 2008, 06:16:02 PM »
Mick,

Have you used your pseudo code? sound very simple and straight forward.  :)


Again, the next correction or addition... still just for solids with rectangular faces.

It finds two faces (points) closed to the min and max points (min-max on solid).

Command: OOB

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #66 on: August 04, 2008, 02:24:47 PM »
Nice work luis,

Try this one, the command it doit


Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #67 on: August 04, 2008, 02:32:56 PM »
Looks good, but where is the bbox :)

Now, try to tested with a cone.... ( it crashes acad  :-( )

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #68 on: August 04, 2008, 02:39:38 PM »
Looks good, but where is the bbox :)

Well my goal was to get the dimension of the solid so I just something like..

Code: [Select]
   if(pSolid.openStatus() == Acad::eOk)
    {
      if(pSolid->transformBy(matrix.inverse()) == Acad::eOk)
      {
        pSolid->getGeomExtents(extents);
        pSolid->cancel();

        AcGePoint3d pt(extents.maxPoint().x - extents.minPoint().x ,
                       extents.maxPoint().y - extents.minPoint().y ,
                       extents.maxPoint().z - extents.minPoint().z);

        pts.append(pt);
      }
    }

Now, try to tested with a cone.... ( it crashes acad  :-( )

OH CARP  :-o

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #69 on: August 04, 2008, 02:42:22 PM »
Looks good, but where is the bbox :)

Well my goal was to get the dimension of the solid so I just something like..

Code: [Select]
   if(pSolid.openStatus() == Acad::eOk)
    {
      if(pSolid->transformBy(matrix.inverse()) == Acad::eOk)
      {
        pSolid->getGeomExtents(extents);
        pSolid->cancel();

        AcGePoint3d pt(extents.maxPoint().x - extents.minPoint().x ,
                       extents.maxPoint().y - extents.minPoint().y ,
                       extents.maxPoint().z - extents.minPoint().z);

        pts.append(pt);
      }
    }

Now, try to tested with a cone.... ( it crashes acad  :-( )

OH CARP  :-o

I know.... I was just asking :)

Again, it is looking good, Daniel.

Keep doing the good work!

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #70 on: August 04, 2008, 02:47:16 PM »
wait...

pSolid

hmm, don't have my visual studio nor my arx sdk....

is transformBy available directly ? I forgot... I am all a mess today

AcDb3Dsolid? or you are casting as an entity?



MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #71 on: August 04, 2008, 04:31:41 PM »
all ent's have the transformBy() method, they  inherit it from Entity (AcDbEntity). ;)
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #72 on: August 04, 2008, 04:39:38 PM »
all ent's have the transformBy() method, they  inherit it from Entity (AcDbEntity). ;)

Gracias Mick :)


Mind is clearing now....

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #73 on: August 05, 2008, 10:20:45 AM »
es muy bueno  :lol:

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #74 on: August 05, 2008, 10:23:40 AM »
es muy bueno  :lol:

Let try it...

(Dan, is that you on the avatar?...)