Close



Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 74

Hybrid View

  1. #1
    I must protest, there is nothing fake going on, no mirroring, no special treatment of quadrants. But there is a modified definition of pow() which preserves the sign ... which is in effect achieving the quadrant mappings.
    Last edited by Paul Bourke; 12-05-2014 at 09:09 PM.

  2. #2
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Because:


    phi(actual) = atan(x/(z-r0))

    As apparent z values get reduced as theta increases, the value of phi(viewed) increases, it does this because (z-r0) is apparently shorter.

    This apparent shortening follows a cos(theta) ratio

  3. #3
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    It's not a homework question. I stopped using pimple cream decades ago. Nor have I enrolled in an Open University course for Seniors.

    I'll have to come clean! After nearly 30 years as a policeman, I'm retired now and can engage my mind in solving the really important questions in policing. This thread is about solving the First World policing problem: "How many doughnuts can you get into a pizza box?"

    Obviously there is too much wasted space if you try to pack round doughnuts (which are an example of the Torus, a 3D object). My researches lead me to this website http://paulbourke.net/geometry/torus/ where I found the answer to part of my problem - the square doughnut.

    According to the author, the general formula for a torus is:



    where
    ro is the radius of a circle midway between the inner and outer edges of the doughnut.
    theta is the angle between the origin of the X,Y plane and ro and ranges from 0 to 2 pi
    n1 is a positive number, but for clear representation is usually between 0.1 and 4. It determines the gross shape of the torus. The value used is chosen by the user.
    n2 is described similarly to n1 but is not necessarily the same value as n1. It determines the shape of the cross section of the torus.
    The value used is chosen by the user.
    r1 is the radius of the cross section
    phi is the angle between the X,Z plane and r1 and ranges from 0 to 2 pi.

    With reference to the diagram:
    torus1.jpg

    consider the case where ro lies along the positive X axis (theta = 0). The circle for the cross section is on X,Z plane. The X coordinate for the centre of the representation of the cross section is (ro + r1). [Its full (X,Y,Z) coordinate would be ((ro + r1),0,0)

    Having waded through all of this, and to make the question relevant to 3D design, I suppose I should pose the question:
    How do I write this general formula is a way that it will work in OpenScad?

    In other words, how do I get OpenScad to automatically use all the values for theta and phi in their respective ranges (0 to 2 pi)?

    Old Man Emu




  4. #4
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Use rotate extrude.

    rotate_extrude(convexity = 10)
    translate([2, 0, 0])
    circle(r = 1);

  5. #5
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    That just makes a round doughnut. I want to make square ones. Scroll down the web page to see what can be done.

    By the way, your object looks better when you specify facets (I picked 75 out of the blue.)

    $fn = 75;
    rotate_extrude(convexity = 10)
    translate([2, 0, 0])
    circle(r = 1);

  6. #6
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    rotate_extrude(convexity = 10, $fn=100)
    translate([2, 0, 0])
    square(r = 1);

  7. #7
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}


    rotate (a = [0, 0, 90]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }


    rotate (a = [0, 0, 180]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }




    rotate (a = [0, 0, 270]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }

  8. #8
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    OK, then you have to do it this way for circular ones.

    rotate_extrude(convexity = 10, $fn=100)
    translate([6, 0, 0])
    polygon(points=[[0,0],[0,10],[10,10],[10,0]], paths=[[0,1,2,3]]);

    The polygon defining your cross sectional shape.

  9. #9
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Hmm, it seems square ones are a lot more complicated because of the parts where they touch.

    First attempt:

    for (i=[1:4]){


    rotate (a = [0, 0, i*90]){
    translate ([0,15,0])
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 35, convexity = 10, $fn=100)
    translate([10, 0, 0])
    polygon(points=[[0,0],[3,3],[0,10],[7,7],[8,8],[10,0]], paths=[[0,1,2,3,4,5]]);
    }}}

    It needs more polygons defining the ends of the shape I think

  10. #10
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Because you can only define variables to work on primatives the only way this can be done is to define a very small sphere (or cube) and then move that through the values of x y z that you want. I will give you any shape but it will take massive processing power to do anything complex.

    For that sort of manipulation it would be a lot easier to work with straight Gcode than anything else. This is because Gcode naturally joins specific dots where Openscad does not.

Page 2 of 6 FirstFirst 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •