• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin][WIP][OpenSource] Bezier Surface

Scheduled Pinned Locked Moved Plugins
245 Posts 69 Posters 47.4k Views
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.
  • J Offline
    jeff hammond
    last edited by 24 Nov 2014, 05:25

    .

    here's a simple introductory example.. maybe something a lot of people can use..
    seamless background for rendering


    1- draw the patch next to a flat plane:
    1.png


    2- double click the patch to enter the editing mode.. select the back line:
    2.png


    3- using the blue arrow on the gizmo, move the edge vertical:
    3.png


    4- using the red arc, rotate the edge downwards 90ΒΊ (degrees will be shown in the measurement box)
    4.png


    5- using the blue square, scale downwards.. align the green control point with the green axis
    5.png


    6- change the segmentation in the measurements box (i think i used 20)

    6.png



    DreamCar.jpg

    dotdotdot

    1 Reply Last reply Reply Quote 0
    • J Offline
      jolran
      last edited by 24 Nov 2014, 07:58

      Wow, this topic is moving fast now. πŸ˜„

      Ok, so it's cubic 4 X 4 Bezier Patch. (As can be seen).

      The idea I had was to conform my surfaces(from the node editor) to be valid with your nice editing possibilities after baked down to Sketchup.

      I've built a simple translation-Gizmo for moving points(must have that at least) but your editing abilities are way more advanced. More than I would need actually in my GUI, since mostly dependent on parameter values..

      This would be at a later stage anyway. There is still plenty of Math to deal with πŸ˜„

      In all case.
      Congratulations to this version! The Gizmo is spectacular. πŸ‘

      BTW
      I don't know if you are gonna continue updating this plugin, since focus is on the subdivision pligin. But if you do and stay with Beziers, have you had a look at the power basis forms ? I studied them a little before since easier to grasp.
      They are used a lot in gamers code.

      They should perform better.
      It's also possible to have other degree curves with different matrix.
      For example a 3 X 3 Patch with degree 2 Power basis.
      Although the @last Bezier code base the degree on n_points so that should be the same.. ?
      (this is for a curve)

      #                      β”Œ            ┐   β”Œ    ┐
      #                      β”‚ βˆ’1  3 βˆ’3 1 β”‚   β”‚ P1 β”‚     MATRIX FORM for Cubic Bezier with 4 controlpoints.
      # P(t) = [tΒ³ tΒ² t 1] Β· β”‚  3 βˆ’6  3 0 β”‚ . β”‚ P2 β”‚
      #                      β”‚ βˆ’3  3  0 0 β”‚   β”‚ P3 β”‚
      #                      β”‚  1  0  0 0 β”‚   β”‚ P3 β”‚
      #                      β””            β”˜   β””    β”˜
      #
      # t = interval-value between 0 and 1. t2 = t*t, t3 = t2*t 
      # For even greater efficiency a,b,c,t3 coefficients could be cached and reused,
      # and updated when interval/subd changes.
      #
      def power_basis(t3,t2,t, p0, p1, p2, p3)
      
      	# Calculate 4 coefficients (MATRIX T*U) where 4th coefficient is simply reusing t3
      	a = t3*(-1) + t2*3    + t*(-3) + 1
      	b = t3*3    + t2*(-6) + t*3 
      	c = t3*(-3) + t2*3 
      
      	# Calculate Points coordinates (MATRIX U*V)
      	x = a*p0.x + b*p1.x + c*p2.x + t3*p3.x
          y = a*p0.y + b*p1.y + c*p2.y + t3*p3.y
          z = a*p0.z + b*p1.z + c*p2.z + t3*p3.z
      	
      	return Geom;;Point3d.new(x,y,z) # Return 1 point from interpolation
      
      end
      
      1 Reply Last reply Reply Quote 0
      • B Online
        Box
        last edited by 24 Nov 2014, 09:41

        I found a little problem with it.
        If you scale to 0 as a way of straightening an edge it freezes and won't update the surface. If you get out of edit mode and go back in an move a point it will revert to the unscaled skin.

        http://i155.photobucket.com/albums/s296/storeben/SU/0Scale.gif

        1 Reply Last reply Reply Quote 0
        • R Offline
          Rich O Brien Moderator
          last edited by 24 Nov 2014, 09:53

          @box

          I'm not seeing that occur for me

          Download the free D'oh Book for SketchUp πŸ“–

          1 Reply Last reply Reply Quote 0
          • B Online
            Box
            last edited by 24 Nov 2014, 10:07

            IT doesn't happen on all axis, I have yet to determine exactly when it happens, but I will pin it down.

            1 Reply Last reply Reply Quote 0
            • B Online
              Box
              last edited by 24 Nov 2014, 10:19

              Try this and see if it is just me.
              The patch is drawn up the blue along the red. Second patch added, joint moved up on the blue. Select the two edges(3 points) on the red and scale to 0.
              Please excuse the sloppy movements, I find it's very hard to maneuver on a trackpad.

              http://i155.photobucket.com/albums/s296/storeben/SU/Red.gif

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 24 Nov 2014, 10:59

                @pilou said:

                @unknownuser said:

                Do you get any errors in the Ruby Console?

                See my previous posts from here

                Messages were the same that the restant on my post linked πŸ˜‰

                So for have no message errors I disconnect plugins after plugins.

                Ah, there's something suspicious:

                @unknownuser said:

                Error: #<NoMethodError: undefined method parent' for nil:NilClass> C:/Users/Pilou/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/ChrisP_PutsCompOnFace.rb:21:in definition'

                Looks like this extension has injected itself into the system somewhere. Maybe it modified .definition. What happens if you remove that extension?
                (Also, where did you get that extension?)

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 24 Nov 2014, 11:02

                  @cadfather said:

                  ok, in my case progressbar.rb is the culprit

                  now it's smartdrop

                  it changes.. πŸ˜†

                  Ah yes, progressbar.rb is also known. But wasn't that updated?

                  Is smart drop also conflicting?

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    thomthom
                    last edited by 24 Nov 2014, 11:07

                    @unclex said:

                    @thomthom said:

                    Re: [Plugin][WIP][OpenSource] Bezier Surface

                    Postby thomthom Β» Mon Nov 24, 2014 4:18 am

                    unclex wrote:It's just always updating...
                    
                    Like the GIF
                    8.gif
                    
                    
                    
                    Cannot Click or DoubleClick
                    
                    and when SU opening, nothing prompt
                    

                    Any errors in the Ruby Console?
                    What SketchUp version?

                    Now I Know what happened
                    Smartdrop clash with TTlib2
                    something named "definition"

                    so I change "definition" to "a4sddefinition" @ smartdrop.rb
                    and it works

                    [attachment=0:nay6raup]<!-- ia0 -->Smartdrop.rb<!-- ia0 -->[/attachment:nay6raup]

                    Right, so this is what is happening:

                    Smartdrop is modifying the SketchUp API classes - which is a Bad Thing (TM)

                    
                    class Sketchup;;Group 
                      def definition
                        return(entities[0].parent) 
                      end 
                    end
                    
                    

                    This method is bugged - it will fail when the group is empty because it tries to get the parent of the first entity in the entities collection. entities.parent would have worked though - so close. (But not perfectly in all older SU versions as there was a SU bug. There is a workaround for that, but that is not implemented here.)
                    This is a good example of why modifying classes and modules that doesn't belong to your own extension is a bad thing. Before SU2015 it was adding a method that was not there, but as of SU2015 we added .definition for Group - meaning now it's also overriding the Ruby API.

                    Was this the latest version of smart drop - or is there a new one that might have fixed this?

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 24 Nov 2014, 11:09

                      @jeff hammond said:

                      .

                      here's a simple introductory example.. maybe something a lot of people can use..
                      seamless background for rendering

                      Wow, tutorials already! 😲 I'm really baffled that people find it usable in any sense - considering it's so much that's missing.

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 24 Nov 2014, 11:11

                        @box said:

                        I found a little problem with it.
                        If you scale to 0 as a way of straightening an edge it freezes and won't update the surface. If you get out of edit mode and go back in an move a point it will revert to the unscaled skin.

                        Yea, I'm not surprised there are errors - I actually would have expected many more reports.
                        I'm going to guess that there are errors in the Ruby Console when your issue occur?

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • B Online
                          Box
                          last edited by 24 Nov 2014, 11:14

                          Yes indeed, was just looking at that. a long error I think repeated.
                          Error: #<ArgumentError: Cannot convert argument to Sketchup::Point3d> C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_patch_quad.rb:528:inintersect_line_line'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_patch_quad.rb:528:in interpolate_points' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_patch_quad.rb:553:in interpolate_interior'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_patch_quad.rb:262:in refresh_interior' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_surface.rb:1046:in block in refresh_automatic_patches'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_surface.rb:1044:in each' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_surface.rb:1044:in refresh_automatic_patches'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_surface.rb:1026:in update_after_transformation' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/bezier_surface.rb:427:in transform_entities'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/operator_gizmo.rb:105:in block in init_gizmo' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:65:in call'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:65:in block (2 levels) in initialize' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:319:in call'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:319:in block in initialize' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:1504:in call'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:1504:in onMouseMove' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:473:in onMouseMove'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TT_Lib2/gizmo_manipulator.rb:156:in onMouseMove' C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/operator_gizmo.rb:70:in onMouseMove'
                          C:/Users/Ben/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_bezier_surface/operator_manager.rb:56:in trigger_event'

                          It appears this keeps repeating, but I could be wrong.

                          Edit: on a second look it doesn't repeat, but is very very long.

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            panixia
                            last edited by 24 Nov 2014, 11:19

                            @thomthom said:

                            I'm really baffled that people find it usable in any sense - considering it's so much that's missing.

                            i bet what people could do out of Sub-d "as it is" would be even more surprising πŸ˜›

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              Pixero
                              last edited by 24 Nov 2014, 11:53

                              I have one request that would make it much more useful.
                              Add support for editing without messing up UVs like your vertex tools works.

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 24 Nov 2014, 14:48

                                @box said:

                                Yes indeed, was just looking at that. a long error I think repeated.

                                Edit: on a second look it doesn't repeat, but is very very long.

                                Thanks for posting the error message.

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • P Offline
                                  pbacot
                                  last edited by 24 Nov 2014, 18:06

                                  So are there instructions or tutorials for this?

                                  MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    jeff hammond
                                    last edited by 24 Nov 2014, 18:07

                                    @thomthom said:

                                    @jeff hammond said:

                                    .

                                    here's a simple introductory example.. maybe something a lot of people can use..
                                    seamless background for rendering

                                    Wow, tutorials already! 😲 I'm really baffled that people find it usable in any sense - considering it's so much that's missing.

                                    heh.. i was just thinking it was a way to show the scale/rotate/move options available via the gizmo.. also a way to point out that using a radius isn't the best way to build a psyche wall..

                                    tangent blends aren't the smoothest since they abruptly change from one direction to another and you will see a more defined line in light/reflections.. you want something that eases into the transition.. bezier surface provides this type of blend (a little more control/ snapping of control points is necessary but as is, it still gets the job done.)

                                    here's a tangent fillet vs one with G3 continuity for example:

                                    radius fillet on the left -- G3 on the right

                                    dotdotdot

                                    1 Reply Last reply Reply Quote 0
                                    • pilouP Offline
                                      pilou
                                      last edited by 24 Nov 2014, 18:40

                                      @unknownuser said:

                                      Error: #<NoMethodError: undefined method `parent' for nil:NilClass>
                                      C:/Users/Pilou/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/ChrisP_PutsCompOnFace.rb:21:in `definition'
                                      

                                      Looks like this extension has injected itself into the system somewhere. Maybe it modified .definition. What happens if you remove that extension?
                                      (Also, where did you get that extension?)

                                      Removed and all works fine πŸ˜‰
                                      This extension is from a French developper πŸ˜‰ Cplassais
                                      Look his other plug at PluginStore ColorEdge
                                      he made also Explode View (with me πŸ˜‰
                                      And numerous other ones it site

                                      Frenchy Pilou
                                      Is beautiful that please without concept!
                                      My Little site :)

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        thomthom
                                        last edited by 24 Nov 2014, 20:56

                                        @pbacot said:

                                        So are there instructions or tutorials for this?

                                        Not much. I basically released this because I haven't been keeping up development lately. So I had thought it was more of a preview and perhaps invite some developers to perhaps contribute in an open source project. However it appear to have drawn a bit more attention than I expected.
                                        There are a couple of videos, though I'm not sure if they are visible in the PluginStore - at least I could not find where they ended up. Though they should be linked in this thread, and on the EW description page. You'll also find them from my YouTube channel.

                                        But they really are just teasers and not how to.

                                        I'm also about to go on vacation for a week so I'll be slow to respond and won't be able to produce anything soon. (I'm in short of time in general.) Meanwhile I'd encourage people to share their experiences on the forum.

                                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                        List of my plugins and link to the CookieWare fund

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          thomthom
                                          last edited by 24 Nov 2014, 20:57

                                          @pilou said:

                                          Look his other plug at PluginStore ColorEdge
                                          he made also Explode View (with me πŸ˜‰
                                          And numerous other ones it site

                                          But the one that cause problems, that not publicly available? I was hoping to be able to inspect it and then see if I could reach out to the author and ask that he can release a new version that doesn't conflict.

                                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                          List of my plugins and link to the CookieWare fund

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 8
                                          • 9
                                          • 10
                                          • 11
                                          • 12
                                          • 13
                                          • 10 / 13
                                          10 / 13
                                          • First post
                                            181/245
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement