Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

SVD

darren_13darren_13 Member, Developers Posts: 119 PRO
I have a vector which is the normal to a plane to create another plane x distance in the normal from the original plane I want to find the unit vector of the normal. I wanted to use svd but I can't figure how to use is where do I put the 'u' in svd? my code looks like this:

//Make Plane normal<div>&nbsp; &nbsp; &nbsp; &nbsp; var centerPlane = evFaceTangentPlane(context, {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "face" : definition.selectPlane,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "parameter" : vector(0.5, 0.5)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var normal = centerPlane.normal</div>

Comments

  • darren_13darren_13 Member, Developers Posts: 119 PRO
    once again don't know why this formatting has changed
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,689
    Hi Darren, I'm not sure I understand the question. You already have the unit normal in your code above. Also what is SVD? (Hope I don't get embarrassed for not knowing what that is!)
    Senior Director, Technical Services, EMEAI
  • darren_13darren_13 Member, Developers Posts: 119 PRO
    ok looking back over the documentation it appears that I do have unit normal that I'm after, so now the question is could I have used svd? in the documentation, 

    svd (m is Matrix) returns map

    Compute the singular value decomposition of a matrix, i.e. su, and v, where m == u * s * v and s is a diagonal matrix of singular values.

    where u would give me a unit vector? how would I set this up?

    It would be really handy if I could view what my variables and constants contain like I do in matlab? because I find myself asking quite a lot of questions I could answer myself if I could see what is being created.

    Thanks for your speedy response :) 

    Darren Lynch

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Darren, centerPlane.normal is already unit-length, so you don't need to do anything with it.  If it were not unit-length, you could use the normalize function to make it unit-length.  The SVD is for other more mathy things (computing matrix rank, orthonormalizing a matrix, computing a pseudo-inverse, principal component analysis, solving poorly conditioned linear systems, finding low-rank matrix approximations, to name a few).
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • darren_13darren_13 Member, Developers Posts: 119 PRO
    ok, thanks ilya! :smile:
Sign In or Register to comment.