Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: about RUST

  1. #11
    Hi Petr
    what do you think about putting your DLL in Rust to GitHub
    of course, but after i complete the Simpson figure DLL, in fact you have provided every thing and it is in fact your DLL. if i have stumbled with it i will tell you.

  2. #12
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Primo,

    you are too kind - the DLL is so barebones that every DLL will be similar.

    As for the sin functions, both of these forms are okay:
    fn main() {
    	let angle_deg: f32 = 45.0; // Equivalent of `dim angle_deg as single = 45`
    	let angle_rad = angle_deg.to_radians(); // Easy conversion to radians
    
    
    	let sinus_of_angle = angle_rad.sin();
    	let another_sinus_of_angle = f32::sin(angle_rad);
    
    
    	println!("Sinus of {} degrees is {}", angle_deg, sinus_of_angle);
    	println!("Sinus of {} degrees is {}", angle_deg, another_sinus_of_angle);
    }
    

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #13
    Hi Petr
    at last i have a compilable version of Rust Dll without errors after a big help from you. but from thinbasic the returned UDT array elements have value = 0 , so there is no graphics but a blank window
    regarding the t variable, when using it as t i got :
    warning: unused variable: `t`
    --> src\user_defined_types.rs:44:13
    |
    44 | let t = t + 0.01;
    | ^ help: consider using `_t` instead
    |
    = note: #[warn(unused_variables)] on by default

    Finished release [optimized] target(s) in 1.31s
    even i have dimmed it before in line 36 so i have changed to _t
    for who wants to compare look this thread:
    http://www.thinbasic.com/community/s...-as-FreeBasic)

    here is the rust code (file user_defined_types.rs in your package in GitHub):
    // User defined types
    #[repr(C)]              // Ensures Rust will not change the order of fields
    #[derive(Debug)]        // Allows to print the struct easily
    pub struct RgbColor
    {
        r: u8, // u8 = BYTE
        g: u8,
        b: u8
    }
    
    #[repr(C)]
    #[derive(Debug)]
    pub struct Vector3D
    {
        x: f32, // f32 = SINGLE
        y: f32,
        z: f32
    }
    
    
    #[no_mangle]
    pub extern fn theta(a: f32) -> f32 {
        if a <= 0.0 {
          0.0    
        } 
        else {
          1.0  
        }
    }
    
    #[no_mangle]
    pub extern fn UDTVector3DArray(vector_ptr: *mut Vector3D, count: i32) {
        let pi: f32 = 3.1415926;
        // Converting pointer to so called slice, the _mut allows us to write
        let vector = unsafe { ::std::slice::from_raw_parts_mut(vector_ptr, count as usize) };
        let _t: f32 = 0.0;
        // Writing new values
        for i in 0..count {
            vector[i as usize].x = ((-5.0/37.0 *f32::sin(61.0/42.0-8.0 *_t)-112.0/41.0 *f32::sin(36.0/23.0-7.0 *_t)-62.0/37.0 *f32::sin(14.0/9.0-6.0 *_t)-31.0/7.0 *f32::sin(69.0/44.0-5.0 *_t)-275.0/13.0 *f32::sin(47.0/30.0-3.0 *_t)-23.0/38.0 *f32::sin(48.0/31.0-2.0 *_t)+461.0/10.0 *f32::sin(_t+107.0/68.0)+8.0/23.0 *f32::sin(4.0 *_t+179.0/38.0)-2345.0/18.0)*theta(71.0 *pi-_t) *theta(_t-67.0 *pi)+(-41.0/74.0 *f32::sin(112.0/75.0-17.0 *_t)-274.0/37.0 *f32::sin(17.0/11.0-11.0 *_t)-907.0/30.0 *f32::sin(36.0/23.0-5.0 *_t)+623.0/15.0 *f32::sin(_t+47.0/30.0)+684.0/29.0 *f32::sin(2.0 *_t+212.0/45.0)+3864.0/25.0 *f32::sin(3.0 *_t+63.0/40.0)+1513.0/78.0 *f32::sin(4.0 *_t+19.0/12.0)+269.0/45.0 *f32::sin(6.0 *_t+14.0/9.0)+66.0/25.0 *f32::sin(7.0 *_t+155.0/33.0)+121.0/35.0 *f32::sin(8.0 *_t+27.0/17.0)+44.0/13.0 *f32::sin(9.0 *_t+35.0/22.0)+71.0/7.0 *f32::sin(10.0 *_t+30.0/19.0)+87.0/40.0 *f32::sin(12.0 *_t+57.0/37.0)+61.0/62.0 *f32::sin(13.0 *_t+47.0/28.0)+43.0/65.0 *f32::sin(14.0 *_t+31.0/20.0)+54.0/37.0 *f32::sin(15.0 *_t+127.0/27.0)+56.0/27.0 *f32::sin(16.0 *_t+30.0/19.0)+11843.0/35.0) *theta(67.0 *pi-_t) *theta(_t-63.0 *pi)+(-119.0/55.0 *f32::sin(65.0/43.0-13.0 *_t)-78.0/11.0 *f32::sin(82.0/55.0-12.0 *_t)-25.0/31.0 *f32::sin(36.0/23.0-11.0 *_t)-70.0/9.0 *f32::sin(31.0/20.0-9.0 *_t)-707.0/65.0 *f32::sin(47.0/30.0-7.0 *_t)-953.0/22.0*f32::sin(45.0/29.0-5.0 *_t)+962.0/15.0 *f32::sin(_t+113.0/72.0)+1091.0/30.0 *f32::sin(2.0 *_t+212.0/45.0)+3177.0/26.0 *f32::sin(3.0 *_t+27.0/17.0)+1685.0/22.0 *f32::sin(4.0 *_t+43.0/27.0)+143.0/27.0 *f32::sin(6.0 *_t+49.0/32.0)+203.0/27.0 *f32::sin(8.0 *_t+27.0/17.0)+411.0/37.0 *f32::sin(10.0 *_t+50.0/31.0)+65.0/27.0 *f32::sin(14.0 *_t+33.0/20.0)+8.0/19.0 *f32::sin(15.0 *_t+13.0/7.0)+3.0/11.0 *f32::sin(16.0 *_t+43.0/33.0)-11597.0/35.0) *theta(63.0 *pi-_t) *theta(_t-59.0 *pi)+(-1.0/7.0 *f32::sin(41.0/81.0-30.0 *_t)-8.0/27.0 *f32::sin(3.0/28.0-28.0 *_t)-10.0/23.0 *f32::sin(3.0/26.0-26.0 *_t)+2377.0/13.0 *f32::sin(_t+33.0/28.0)+43.0/15.0 *f32::sin(2.0 *_t+26.0/7.0)+131.0/18.0 *f32::sin(3.0 *_t+3.0/25.0)+45.0/41.0 *f32::sin(4.0 *_t+105.0/32.0)+43.0/14.0 *f32::sin(5.0 *_t+87.0/23.0)+135.0/136.0 *f32::sin(6.0 *_t+51.0/20.0)+51.0/14.0 *f32::sin(7.0 *_t+118.0/43.0)+19.0/18.0 *f32::sin(8.0 *_t+23.0/18.0)+49.0/23.0 *f32::sin(9.0 *_t+25.0/12.0)+14.0/19.0 *f32::sin(10.0 *_t+63.0/55.0)+54.0/49.0 *f32::sin(11.0 *_t+68.0/41.0)+32.0/37.0 *f32::sin(12.0 *_t+30.0/29.0)+5.0/12.0 *f32::sin(13.0 *_t+43.0/24.0)+34.0/45.0 *f32::sin(14.0 *_t+15.0/17.0)+13.0/30.0 *f32::sin(15.0 *_t+67.0/23.0)+21.0/31.0 *f32::sin(16.0 *_t+43.0/60.0)+25.0/62.0 *f32::sin(17.0 *_t+89.0/34.0)+9.0/20.0 *f32::sin(18.0 *_t+11.0/26.0)+4.0/17.0 *f32::sin(19.0 *_t+55.0/28.0)+26.0/51.0 *f32::sin(20.0 *_t+4.0/17.0)+2.0/33.0 *f32::sin(21.0 *_t+247.0/62.0)+14.0/31.0 *f32::sin(22.0 *_t+9.0/44.0)+5.0/26.0 *f32::sin(23.0 *_t+113.0/34.0)+9.0/17.0 *f32::sin(24.0 *_t+3.0/10.0)+4.0/25.0 *f32::sin(25.0 *_t+99.0/32.0)+6.0/23.0 *f32::sin(27.0 *_t+548.0/183.0)+10.0/33.0 *f32::sin(29.0 *_t+129.0/37.0)+5.0/12.0 *f32::sin(31.0 *_t+127.0/39.0)-9719.0/87.0) *theta(59.0 *pi-_t) *theta(_t-55.0 *pi)+(228.0/65.0 *f32::sin(_t+116.0/33.0)+353.0/40.0 *f32::sin(2.0 *_t+33.0/19.0)+107.0/24.0 *f32::sin(3.0 *_t+58.0/33.0)+58.0/21.0 *f32::sin(4.0 *_t+519.0/130.0)+19.0/15.0 *f32::sin(5.0 *_t+45.0/37.0)+13.0/12.0 *f32::sin(6.0 *_t+145.0/38.0)+43.0/42.0 *f32::sin(7.0 *_t+25.0/99.0)+11.0/19.0 *f32::sin(8.0 *_t+105.0/44.0)+203.0/19.0) *theta(55.0 *pi-_t) *theta(_t-51.0 *pi)+(-23.0/10.0*f32::sin(22.0/17.0-4.0 *_t)-159.0/17.0 *f32::sin(156.0/125.0-3.0 *_t)+523.0/112.0 *f32::sin(_t+80.0/21.0)+111.0/23.0 *f32::sin(2.0 *_t+25.0/24.0)+92.0/79.0 *f32::sin(5.0 *_t+57.0/32.0)+58.0/37.0 *f32::sin(6.0 *_t+159.0/35.0)+18.0/31.0 *f32::sin(7.0 *_t+27.0/43.0)-7563.0/28.0) *theta(51.0 *pi-_t) *theta(_t-47.0 *pi)+(-76.0/17.0 *f32::sin(42.0/41.0-14.0 *_t)-154.0/31.0 *f32::sin(37.0/38.0-11.0 *_t)+10820.0/41.0 *f32::sin(_t+25.0/34.0)+1476.0/31.0 *f32::sin(2.0 *_t+36.0/19.0)+595.0/12.0 *f32::sin(3.0 *_t+67.0/43.0)+3568.0/67.0 *f32::sin(4.0 *_t+282.0/77.0)+974.0/59.0 *f32::sin(5.0 *_t+40.0/19.0)+427.0/18.0 *f32::sin(6.0 *_t+47.0/25.0)+454.0/23.0 *f32::sin(7.0 *_t+20.0/27.0)+41.0/40.0 *f32::sin(8.0 *_t+9.0/2.0)+139.0/22.0 *f32::sin(9.0 *_t+99.0/26.0)+276.0/37.0 *f32::sin(10.0 *_t+37.0/29.0)+113.0/25.0 *f32::sin(12.0 *_t+61.0/30.0)+37.0/29.0 *f32::sin(13.0 *_t+37.0/31.0)+51.0/19.0 *f32::sin(15.0 *_t+127.0/34.0)+115.0/72.0 *f32::sin(16.0 *_t+7.0/38.0)+162.0/43.0 *f32::sin(17.0 *_t+67.0/21.0)+26.0/33.0 *f32::sin(18.0 *_t+194.0/45.0)-3614.0/99.0) *theta(47.0 *pi-_t) *theta(_t-43.0 *pi)+(347.0/17.0 *f32::sin(_t+3.0/13.0)+9951.0/41.0) *theta(43.0 *pi-_t) *theta(_t-39.0 *pi)+(760.0/29.0 *f32::sin(_t+23.0/25.0)-6059.0/28.0)*theta(39.0 *pi-_t) *theta(_t-35.0 *pi)+(-106.0/41.0 *f32::sin(7.0/13.0-18.0 *_t)-55.0/38.0 *f32::sin(13.0/29.0-16.0 *_t)-173.0/19.0 *f32::sin(34.0/29.0-7.0 *_t)-484.0/31.0 *f32::sin(13.0/16.0-5.0 *_t)-1193.0/17.0 *f32::sin(97.0/83.0-2.0 *_t)+6885.0/26.0 *f32::sin(_t+41.0/48.0)+99.0/5.0 *f32::sin(3.0 *_t+5.0/16.0)+751.0/36.0 *f32::sin(4.0 *_t+73.0/18.0)+129.0/40.0 *f32::sin(6.0 *_t+83.0/18.0)+327.0/31.0 *f32::sin(8.0 *_t+17.0/23.0)+498.0/47.0 *f32::sin(9.0 *_t+123.0/88.0)+298.0/49.0 *f32::sin(10.0 *_t+54.0/25.0)+82.0/15.0 *f32::sin(11.0 *_t+153.0/35.0)+106.0/27.0 *f32::sin(12.0 *_t+3.0/32.0)+171.0/43.0 *f32::sin(13.0 *_t+433.0/173.0)+36.0/11.0 *f32::sin(14.0 *_t+98.0/33.0)+39.0/22.0 *f32::sin(15.0 *_t+97.0/25.0)+68.0/37.0 *f32::sin(17.0 *_t+157.0/34.0)-227.0/29.0) *theta(35.0 *pi-_t) *theta(_t-31.0 *pi)+(-2.0/15.0 *f32::sin(66.0/47.0-14.0 *_t)-45.0/23.0 *f32::sin(5.0/9.0-11.0 *_t)-151.0/43.0 *f32::sin(13.0/32.0-8.0 *_t)-31.0/36.0 *f32::sin(24.0/19.0-7.0 *_t)+2121.0/32.0 *f32::sin(_t+45.0/38.0)+2085.0/47.0 *f32::sin(2.0 *_t+299.0/88.0)+1321.0/43.0 *f32::sin(3.0 *_t+72.0/25.0)+557.0/37.0 *f32::sin(4.0 *_t+74.0/21.0)+205.0/17.0 *f32::sin(5.0 *_t+27.0/23.0)+13.0/9.0 *f32::sin(6.0 *_t+113.0/32.0)+35.0/17.0 *f32::sin(9.0 *_t+7.0/22.0)+93.0/26.0 *f32::sin(10.0 *_t+112.0/25.0)+11.0/14.0 *f32::sin(12.0 *_t+58.0/17.0)+8.0/15.0 *f32::sin(13.0 *_t+47.0/30.0)+33.0/20.0 *f32::sin(15.0 *_t+32.0/25.0)+31.0/94.0 *f32::sin(16.0 *_t+192.0/59.0)+35.0/31.0 *f32::sin(17.0 *_t+51.0/77.0)+9473.0/34.0) *theta(31.0 *pi-_t) *theta(_t-27.0 *pi)+(-33.0/29.0 *f32::sin(27.0/55.0-12.0 *_t)+388.0/13.0 *f32::sin(_t+5.0/13.0)+2087.0/30.0 *f32::sin(2.0 *_t+193.0/55.0)+1311.0/49.0 *f32::sin(3.0 *_t+133.0/30.0)+993.0/41.0 *f32::sin(4.0 *_t+134.0/31.0)+175.0/17.0 *f32::sin(5.0 *_t+73.0/29.0)+83.0/23.0 *f32::sin(6.0 *_t+28.0/33.0)+9.0/19.0 *f32::sin(7.0 *_t+73.0/36.0)+101.0/32.0 *f32::sin(8.0 *_t+57.0/28.0)+51.0/25.0 *f32::sin(9.0 *_t+106.0/39.0)+47.0/28.0 *f32::sin(10.0 *_t+129.0/47.0)+17.0/29.0 *f32::sin(11.0 *_t+33.0/17.0)+27.0/22.0 *f32::sin(13.0 *_t+155.0/86.0)+108.0/65.0 *f32::sin(14.0 *_t+8.0/27.0)+9.0/16.0 *f32::sin(15.0 *_t+44.0/13.0)+11.0/14.0 *f32::sin(16.0 *_t+3.0/19.0)+11.0/23.0 *f32::sin(17.0 *_t+106.0/23.0)+9.0/64.0 *f32::sin(18.0 *_t+97.0/22.0)-10004.0/35.0) *theta(27.0 *pi-_t) *theta(_t-23.0 *pi)+(-18.0/13.0 *f32::sin(7.0/50.0-18.0 *_t)-7.0/5.0 *f32::sin(1.0/10.0-16.0 *_t)-51.0/25.0 *f32::sin(18.0/19.0-12.0 *_t)-219.0/35.0 *f32::sin(7.0/30.0-10.0 *_t)-158.0/43.0 *f32::sin(40.0/37.0-6.0 *_t)-512.0/25.0 *f32::sin(13.0/16.0-4.0 *_t)-289.0/29.0 *f32::sin(68.0/67.0-2.0 *_t)+18315.0/101.0 *f32::sin(_t+29.0/18.0)+664.0/31.0 *f32::sin(3.0 *_t+61.0/23.0)+48.0/11.0 *f32::sin(5.0 *_t+84.0/67.0)+489.0/49.0 *f32::sin(7.0 *_t+11.0/25.0)+397.0/33.0 *f32::sin(8.0 *_t+8.0/19.0)+73.0/12.0 *f32::sin(9.0 *_t+9.0/53.0)+194.0/41.0 *f32::sin(11.0 *_t+17.0/14.0)+2.0/3.0 *f32::sin(13.0 *_t+149.0/50.0)+43.0/29.0 *f32::sin(14.0 *_t+91.0/31.0)+61.0/35.0*f32::sin(15.0 *_t+131.0/56.0)+29.0/37.0 *f32::sin(17.0 *_t+1.0/19.0)+49.0/43.0 *f32::sin(19.0 *_t+65.0/24.0)+15.0/19.0 *f32::sin(20.0 *_t+88.0/21.0)+11.0/38.0 *f32::sin(21.0 *_t+217.0/50.0)+3917.0/10.0) *theta(23.0 *pi-_t) *theta(_t-19.0 *pi)+(-8.0/9.0 *f32::sin(12.0/23.0-16.0 *_t)-504.0/53.0 *f32::sin(8.0/29.0-8.0 *_t)-635.0/43.0 *f32::sin(32.0/37.0-4.0 *_t)-307.0/41.0 *f32::sin(8.0/27.0-3.0 *_t)-20292.0/91.0 *f32::sin(16.0/19.0-_t)+483.0/19.0 *f32::sin(2.0 *_t+41.0/13.0)+108.0/23.0 *f32::sin(5.0 *_t+70.0/29.0)+74.0/35.0 *f32::sin(6.0 *_t+145.0/34.0)+287.0/43.0 *f32::sin(7.0 *_t+69.0/16.0)+254.0/39.0 *f32::sin(9.0 *_t+5.0/27.0)+19.0/4.0 *f32::sin(10.0 *_t+37.0/30.0)+129.0/46.0 *f32::sin(11.0 *_t+75.0/32.0)+24.0/19.0 *f32::sin(12.0 *_t+71.0/46.0)+125.0/52.0 *f32::sin(13.0 *_t+87.0/44.0)+46.0/27.0 *f32::sin(14.0 *_t+40.0/31.0)+26.0/29.0 *f32::sin(15.0 *_t+106.0/27.0)+25.0/63.0 *f32::sin(17.0 *_t+53.0/12.0)+23.0/22.0 *f32::sin(18.0 *_t+9.0/29.0)+3.0/35.0 *f32::sin(19.0 *_t+205.0/103.0)+200.0/201.0 *f32::sin(20.0 *_t+22.0/25.0)+8.0/31.0 *f32::sin(21.0 *_t+77.0/25.0)-15195.0/29.0) *theta(19.0 *pi-_t) *theta(_t-15.0 *pi)+(-15.0/23.0 *f32::sin(22.0/23.0-35.0 *_t)-21.0/26.0 *f32::sin(13.0/40.0-30.0 *_t)-71.0/64.0 *f32::sin(16.0/19.0-29.0 *_t)-97.0/29.0 *f32::sin(15.0/41.0-23.0 *_t)-57.0/17.0 *f32::sin(54.0/35.0-16.0 *_t)-79.0/25.0 *f32::sin(41.0/39.0-14.0 *_t)-24.0/11.0 *f32::sin(3.0/8.0-13.0 *_t)-149.0/17.0 *f32::sin(21.0/62.0-6.0 *_t)-613.0/31.0 *f32::sin(16.0/17.0-2.0 *_t)+6033.0/20.0 *f32::sin(_t+24.0/17.0)+631.0/16.0 *f32::sin(3.0 *_t+127.0/30.0)+463.0/31.0 *f32::sin(4.0 *_t+71.0/28.0)+94.0/23.0 *f32::sin(5.0 *_t+98.0/25.0)+45.0/11.0 *f32::sin(7.0 *_t+31.0/10.0)+39.0/23.0 *f32::sin(8.0 *_t+163.0/39.0)+23.0/22.0 *f32::sin(9.0 *_t+42.0/17.0)+167.0/44.0 *f32::sin(10.0 *_t+232.0/231.0)+233.0/49.0 *f32::sin(11.0 *_t+29.0/45.0)+194.0/129.0 *f32::sin(12.0 *_t+3.0/5.0)+166.0/37.0 *f32::sin(15.0 *_t+83.0/29.0)+123.0/35.0 *f32::sin(17.0 *_t+136.0/35.0)+47.0/26.0 *f32::sin(18.0 *_t+64.0/25.0)+72.0/35.0 *f32::sin(19.0 *_t+41.0/14.0)+56.0/31.0 *f32::sin(20.0 *_t+48.0/35.0)+63.0/25.0 *f32::sin(21.0 *_t+2.0/5.0)+100.0/37.0 *f32::sin(22.0 *_t+13.0/15.0)+4.0/3.0 *f32::sin(24.0 *_t+59.0/19.0)+17.0/25.0 *f32::sin(25.0 *_t+15.0/38.0)+51.0/19.0 *f32::sin(26.0 *_t+68.0/19.0)+11.0/27.0 *f32::sin(27.0 *_t+228.0/91.0)+19.0/14.0 *f32::sin(28.0 *_t+31.0/9.0)+4.0/13.0 *f32::sin(31.0 *_t+14.0/55.0)+31.0/37.0 *f32::sin(32.0 *_t+2.0/31.0)+150.0/151.0*f32::sin(33.0 *_t+58.0/21.0)+41.0/32.0 *f32::sin(34.0 *_t+26.0/11.0)+4.0/3.0 *f32::sin(36.0 *_t+25.0/18.0)-6956.0/53.0) *theta(15.0 *pi-_t) *theta(_t-11.0 *pi)+(4337.0/36.0 *f32::sin(_t+45.0/29.0)+265.0/18.0) *theta(11.0 *pi-_t) *theta(_t-7.0 *pi)+(-23.0/21.0 *f32::sin(31.0/61.0-_t)-1152.0/11.0) *theta(7.0 *pi-_t) *theta(_t-3.0*pi)+(3314.0/27.0 *f32::sin(_t+30.0/31.0)+65.0/31.0 *f32::sin(2.0 *_t+26.0/23.0)-1467.0/5.0) *theta(3.0 *pi-_t) *theta(_t+pi)) *theta(f32::sqrt(f32::signum(f32::sin(_t/2.0))));
            vector[i as usize].y = ((-9.0/23.0 *f32::sin(38.0/25.0-6.0 *_t)-67.0/38.0 *f32::sin(36.0/23.0-3.0 *_t)+31.0/30.0 *f32::sin(_t+14.0/9.0)+409.0/9.0 *f32::sin(2.0 *_t+74.0/47.0)+493.0/141.0 *f32::sin(4.0 *_t+85.0/54.0)+14.0/17.0 *f32::sin(5.0 *_t+75.0/16.0)+5.0/46.0 *f32::sin(7.0 *_t+21.0/13.0)+33.0/23.0 *f32::sin(8.0 *_t+74.0/47.0)+14536.0/41.0) *theta(71.0 *pi-_t) *theta(_t-67.0 *pi)+(-89.0/29.0 *f32::sin(59.0/38.0-17.0 *_t)-5.0/11.0 *f32::sin(14.0/9.0-16.0 *_t)-99.0/40.0 *f32::sin(58.0/37.0-15.0 *_t)-59.0/7.0 *f32::sin(25.0/16.0-11.0 *_t)-2.0/35.0 *f32::sin(8.0/41.0-10.0 *_t)-381.0/26.0*f32::sin(25.0/16.0-9.0 *_t)-67.0/21.0 *f32::sin(17.0/11.0-8.0 *_t)-1706.0/37.0 *f32::sin(36.0/23.0-5.0 *_t)-29.0/9.0 *f32::sin(29.0/19.0-4.0 *_t)-851.0/29.0 *f32::sin(58.0/37.0-3.0 *_t)+1991.0/30.0 *f32::sin(_t+96.0/61.0)+528.0/17.0 *f32::sin(2.0 *_t+85.0/54.0)+89.0/67.0 *f32::sin(6.0 *_t+37.0/24.0)+102.0/13.0 *f32::sin(7.0 *_t+80.0/17.0)+17.0/16.0 *f32::sin(12.0 *_t+91.0/58.0)+35.0/12.0 *f32::sin(13.0 *_t+37.0/23.0)+127.0/27.0 *f32::sin(14.0 *_t+27.0/17.0)-26576.0/29.0) *theta(67.0 *pi-_t) *theta(_t-63.0 *pi)+(-29.0/14.0 *f32::sin(47.0/33.0-16.0 *_t)-35.0/22.0 *f32::sin(75.0/52.0-15.0 *_t)-236.0/63.0 *f32::sin(16.0/11.0-14.0 *_t)-41.0/6.0 *f32::sin(34.0/23.0-13.0 *_t)-236.0/29.0 *f32::sin(46.0/31.0-12.0 *_t)-167.0/28.0 *f32::sin(55.0/37.0-11.0 *_t)-259.0/33.0 *f32::sin(76.0/51.0-10.0 *_t)-414.0/73.0 *f32::sin(56.0/37.0-9.0 *_t)-121.0/28.0 *f32::sin(17.0/11.0-7.0 *_t)-177.0/32.0 *f32::sin(61.0/41.0-6.0 *_t)-1499.0/41.0 *f32::sin(48.0/31.0-5.0 *_t)-647.0/23.0 *f32::sin(25.0/16.0-3.0 *_t)+610.0/13.0 *f32::sin(_t+30.0/19.0)+1474.0/31.0 *f32::sin(2.0 *_t+30.0/19.0)+807.0/41.0 *f32::sin(4.0 *_t+41.0/26.0)+208.0/31.0 *f32::sin(8.0 *_t+43.0/27.0)-16147.0/17.0) *theta(63.0 *pi-_t) *theta(_t-59.0 *pi)+(-12.0/41.0 *f32::sin(1.0/4.0-28.0 *_t)-11.0/43.0 *f32::sin(9.0/14.0-26.0 *_t)-17.0/41.0 *f32::sin(14.0/13.0-24.0 *_t)-22.0/31.0 *f32::sin(17.0/67.0-22.0 *_t)-7.0/10.0 *f32::sin(64.0/63.0-19.0 *_t)-69.0/41.0 *f32::sin(39.0/31.0-14.0 *_t)-86.0/25.0 *f32::sin(22.0/41.0-12.0 *_t)-87.0/52.0 *f32::sin(31.0/27.0-9.0 *_t)-23.0/15.0 *f32::sin(13.0/33.0-7.0 *_t)-25.0/17.0 *f32::sin(22.0/25.0-3.0 *_t)+159.0/28.0 *f32::sin(_t+249.0/248.0)+571.0/20.0 *f32::sin(2.0 *_t+23.0/26.0)+109.0/36.0 *f32::sin(4.0 *_t+29.0/18.0)+161.0/58.0 *f32::sin(5.0 *_t+31.0/23.0)+147.0/26.0 *f32::sin(6.0 *_t+31.0/19.0)+199.0/35.0 *f32::sin(8.0 *_t+37.0/42.0)+96.0/19.0 *f32::sin(10.0 *_t+17.0/47.0)+64.0/27.0 *f32::sin(11.0 *_t+337.0/75.0)+15.0/7.0 *f32::sin(13.0 *_t+157.0/44.0)+f32::sin(15.0 *_t+101.0/33.0)+5.0/38.0 *f32::sin(16.0 *_t+1.0/28.0)+11.0/56.0 *f32::sin(17.0 *_t+23.0/37.0)+6.0/11.0 *f32::sin(18.0 *_t+8.0/9.0)+91.0/136.0 *f32::sin(20.0 *_t+3.0/19.0)+55.0/54.0 *f32::sin(21.0 *_t+102.0/25.0)+15.0/16.0 *f32::sin(23.0*_t+118.0/31.0)+22.0/27.0 *f32::sin(25.0 *_t+49.0/15.0)+3.0/8.0 *f32::sin(27.0 *_t+27.0/8.0)+22.0/43.0 *f32::sin(29.0 *_t+57.0/16.0)+10.0/19.0 *f32::sin(30.0 *_t+50.0/83.0)+5.0/31.0 *f32::sin(31.0 *_t+121.0/38.0)+2727.0/23.0) *theta(59.0 *pi-_t) *theta(_t-55.0 *pi)+(-41.0/31.0 *f32::sin(23.0/21.0-4.0 *_t)-85.0/14.0 *f32::sin(17.0/32.0-_t)+407.0/35.0 *f32::sin(2.0 *_t+75.0/22.0)+21.0/10.0 *f32::sin(3.0 *_t+41.0/14.0)+53.0/54.0 *f32::sin(5.0 *_t+54.0/25.0)+31.0/61.0 *f32::sin(6.0 *_t+124.0/27.0)+5.0/36.0 *f32::sin(7.0 *_t+3.0/19.0)+19.0/31.0 *f32::sin(8.0 *_t+144.0/31.0)+10393.0/23.0) *theta(55.0 *pi-_t) *theta(_t-51.0 *pi)+(-36.0/41.0 *f32::sin(5.0/18.0-6.0 *_t)+83.0/35.0 *f32::sin(_t+95.0/28.0)+43.0/37.0 *f32::sin(2.0 *_t+66.0/17.0)+165.0/13.0 *f32::sin(3.0 *_t+27.0/53.0)+79.0/19.0 *f32::sin(4.0 *_t+9.0/17.0)+37.0/24.0 *f32::sin(5.0 *_t+190.0/63.0)+57.0/58.0 *f32::sin(7.0 *_t+267.0/100.0)+13545.0/31.0) *theta(51.0 *pi-_t) *theta(_t-47.0 *pi)+(-123.0/47.0 *f32::sin(19.0/15.0-18.0 *_t)-59.0/29.0 *f32::sin(1.0/49.0-16.0 *_t)-213.0/37.0 *f32::sin(29.0/22.0-13.0 *_t)-381.0/40.0 *f32::sin(4.0/29.0-11.0 *_t)-168.0/29.0 *f32::sin(6.0/11.0-10.0 *_t)-1233.0/44.0 *f32::sin(3.0/19.0-3.0 *_t)-711.0/7.0 *f32::sin(1.0/39.0-2.0 *_t)-5171.0/26.0 *f32::sin(12.0/19.0-_t)+2965.0/57.0 *f32::sin(4.0 *_t+89.0/28.0)+347.0/21.0 *f32::sin(5.0 *_t+23.0/93.0)+1087.0/69.0 *f32::sin(6.0 *_t+4.0/31.0)+760.0/37.0 *f32::sin(7.0 *_t+172.0/53.0)+333.0/19.0 *f32::sin(8.0 *_t+7.0/13.0)+325.0/81.0 *f32::sin(9.0 *_t+96.0/55.0)+53.0/17.0 *f32::sin(12.0 *_t+138.0/49.0)+73.0/40.0 *f32::sin(14.0 *_t+92.0/67.0)+47.0/31.0 *f32::sin(15.0 *_t+81.0/19.0)+7.0/11.0*f32::sin(17.0 *_t+29.0/30.0)-3017.0/19.0) *theta(47.0 *pi-_t) *theta(_t-43.0 *pi)+(-713.0/27.0 *f32::sin(22.0/17.0-_t)-36840.0/41.0) *theta(43.0 *pi-_t) *theta(_t-39.0 *pi)+(-675.0/23.0 *f32::sin(13.0/16.0-_t)-17750.0/19.0) *theta(39.0 *pi-_t) *theta(_t-35.0 *pi)+(-39.0/29.0 *f32::sin(11.0/16.0-17.0 *_t)-102.0/37.0 *f32::sin(8.0/49.0-11.0 *_t)-95.0/34.0 *f32::sin(4.0/13.0-9.0 *_t)-71.0/22.0 *f32::sin(7.0/12.0-8.0 *_t)-194.0/17.0 *f32::sin(29.0/23.0-7.0 *_t)-2531.0/25.0 *f32::sin(13.0/36.0-_t)+601.0/19.0 *f32::sin(2.0 *_t+264.0/61.0)+232.0/5.0 *f32::sin(3.0 *_t+53.0/13.0)+309.0/40.0 *f32::sin(4.0 *_t+29.0/10.0)+266.0/39.0 *f32::sin(5.0 *_t+3.0/16.0)+71.0/95.0 *f32::sin(6.0 *_t+50.0/37.0)+281.0/44.0 *f32::sin(10.0 *_t+33.0/43.0)+29.0/15.0 *f32::sin(12.0 *_t+105.0/29.0)+39.0/25.0 *f32::sin(13.0 *_t+109.0/36.0)+24.0/11.0 *f32::sin(14.0 *_t+51.0/38.0)+19.0/9.0 *f32::sin(15.0 *_t+38.0/23.0)+43.0/29.0 *f32::sin(16.0 *_t+4.0)+53.0/74.0 *f32::sin(18.0 *_t+74.0/25.0)-45956.0/91.0)*theta(35.0 *pi-_t) *theta(_t-31.0 *pi)+(-25.0/32.0 *f32::sin(4.0/13.0-15.0 *_t)-40.0/43.0 *f32::sin(11.0/19.0-13.0 *_t)-12727.0/115.0 *f32::sin(83.0/84.0-_t)+1762.0/31.0 *f32::sin(2.0 *_t+66.0/29.0)+905.0/78.0 *f32::sin(3.0 *_t+46.0/25.0)+209.0/25.0 *f32::sin(4.0 *_t+104.0/37.0)+103.0/27.0 *f32::sin(5.0 *_t+32.0/17.0)+121.0/60.0 *f32::sin(6.0 *_t+143.0/37.0)+29.0/7.0 *f32::sin(7.0 *_t+45.0/13.0)+41.0/36.0 *f32::sin(8.0 *_t+271.0/58.0)+125.0/62.0 *f32::sin(9.0 *_t+152.0/33.0)+118.0/79.0 *f32::sin(10.0 *_t+56.0/25.0)+41.0/24.0 *f32::sin(11.0 *_t+108.0/25.0)+22.0/45.0 *f32::sin(12.0 *_t+116.0/41.0)+43.0/35.0 *f32::sin(14.0 *_t+68.0/19.0)+1.0/15.0 *f32::sin(16.0 *_t+26.0/11.0)+13.0/43.0 *f32::sin(17.0 *_t+53.0/25.0)-29541.0/41.0) *theta(31.0 *pi-_t) *theta(_t-27.0 *pi)+(-235.0/21.0 *f32::sin(5.0/46.0-5.0 *_t)-133.0/13.0 *f32::sin(3.0/29.0-4.0 *_t)-437.0/37.0 *f32::sin(50.0/37.0-3.0 *_t)-2785.0/19.0 *f32::sin(5.0/4.0-_t)+724.0/17.0 *f32::sin(2.0 *_t+68.0/29.0)+211.0/141.0 *f32::sin(6.0 *_t+83.0/44.0)+41.0/14.0 *f32::sin(7.0 *_t+135.0/32.0)+83.0/20.0 *f32::sin(8.0 *_t+135.0/38.0)+123.0/62.0 *f32::sin(9.0 *_t+136.0/33.0)+304.0/203.0 *f32::sin(10.0 *_t+166.0/47.0)+59.0/44.0 *f32::sin(11.0 *_t+5.0/29.0)+25.0/36.0 *f32::sin(12.0 *_t+102.0/49.0)+13.0/12.0 *f32::sin(13.0 *_t+101.0/41.0)+23.0/13.0 *f32::sin(14.0 *_t+73.0/26.0)+5.0/32.0 *f32::sin(15.0 *_t+85.0/27.0)+41.0/61.0 *f32::sin(16.0 *_t+56.0/25.0)+1.0/7.0 *f32::sin(17.0 *_t+10.0/17.0)+7.0/18.0 *f32::sin(18.0*_t+134.0/51.0)-8059.0/11.0) *theta(27.0 *pi-_t) *theta(_t-23.0 *pi)+(-32.0/23.0 *f32::sin(20.0/27.0-18.0 *_t)-31.0/20.0 *f32::sin(19.0/17.0-17.0 *_t)-89.0/38.0 *f32::sin(30.0/23.0-13.0 *_t)-529.0/122.0 *f32::sin(22.0/15.0-10.0 *_t)-151.0/35.0 *f32::sin(2.0/27.0-8.0 *_t)-417.0/28.0 *f32::sin(43.0/29.0-4.0 *_t)-851.0/35.0 *f32::sin(3.0/14.0-3.0 *_t)-13229.0/88.0 *f32::sin(31.0/52.0-_t)+425.0/12.0 *f32::sin(2.0 *_t+37.0/18.0)+397.0/30.0 *f32::sin(5.0 *_t+37.0/17.0)+299.0/31.0 *f32::sin(6.0*_t+122.0/41.0)+301.0/38.0 *f32::sin(7.0 *_t+58.0/35.0)+240.0/43.0 *f32::sin(9.0 *_t+118.0/27.0)+39.0/28.0 *f32::sin(11.0 *_t+27.0/34.0)+82.0/165.0 *f32::sin(12.0 *_t+58.0/27.0)+29.0/26.0 *f32::sin(14.0 *_t+77.0/27.0)+47.0/19.0 *f32::sin(15.0 *_t+7.0/4.0)+46.0/17.0 *f32::sin(16.0 *_t+79.0/22.0)+46.0/35.0 *f32::sin(19.0 *_t+43.0/21.0)+23.0/28.0 *f32::sin(20.0 *_t+105.0/31.0)+27.0/23.0 *f32::sin(21.0 *_t+184.0/41.0)-12036.0/55.0) *theta(23.0 *pi-_t) *theta(_t-19.0 *pi)+(-16.0/37.0 *f32::sin(42.0/43.0-19.0 *_t)-21.0/23.0 *f32::sin(37.0/26.0-18.0 *_t)-23.0/17.0 *f32::sin(25.0/56.0-17.0 *_t)-46.0/61.0 *f32::sin(34.0/45.0-16.0 *_t)-161.0/22.0 *f32::sin(1.0/2.0-6.0 *_t)-472.0/43.0 *f32::sin(15.0/23.0-5.0 *_t)-620.0/29.0 *f32::sin(43.0/60.0-3.0 *_t)+2821.0/25.0 *f32::sin(_t+167.0/39.0)+2605.0/88.0 *f32::sin(2.0 *_t+89.0/30.0)+449.0/43.0 *f32::sin(4.0 *_t+66.0/25.0)+37.0/24.0 *f32::sin(7.0 *_t+37.0/33.0)+107.0/13.0 *f32::sin(8.0 *_t+175.0/52.0)+341.0/128.0 *f32::sin(9.0 *_t+188.0/41.0)+32.0/15.0 *f32::sin(10.0 *_t+12.0/19.0)+208.0/43.0 *f32::sin(11.0 *_t+44.0/73.0)+122.0/53.0 *f32::sin(12.0 *_t+41.0/39.0)+69.0/40.0 *f32::sin(13.0 *_t+9.0/32.0)+34.0/23.0 *f32::sin(14.0 *_t+208.0/45.0)+19.0/11.0 *f32::sin(15.0 *_t+11.0/36.0)+17.0/19.0 *f32::sin(20.0 *_t+111.0/26.0)+4.0/15.0 *f32::sin(21.0 *_t+26.0/25.0)-10055.0/37.0) *theta(19.0 *pi-_t) *theta(_t-15.0 *pi)+(-59.0/44.0 *f32::sin(173.0/172.0-36.0 *_t)-73.0/31.0 *f32::sin(21.0/53.0-30.0 *_t)-23.0/11.0 *f32::sin(13.0/12.0-29.0 *_t)-133.0/50.0 *f32::sin(23.0/19.0-28.0 *_t)-125.0/29.0 *f32::sin(108.0/77.0-24.0 *_t)-122.0/33.0 *f32::sin(1.0/19.0-21.0 *_t)-238.0/79.0 *f32::sin(4.0/7.0-16.0 *_t)-141.0/16.0 *f32::sin(34.0/37.0-9.0 *_t)-45.0/8.0 *f32::sin(16.0/27.0-7.0 *_t)+11594.0/23.0 *f32::sin(_t+1768.0/589.0)+1582.0/37.0 *f32::sin(2.0 *_t+28.0/25.0)+771.0/38.0 *f32::sin(3.0 *_t+107.0/31.0)+863.0/22.0 *f32::sin(4.0 *_t+87.0/22.0)+485.0/29.0 *f32::sin(5.0 *_t+63.0/25.0)+27.0/8.0 *f32::sin(6.0 *_t+75.0/76.0)+106.0/19.0 *f32::sin(8.0 *_t+20.0/23.0)+54.0/17.0 *f32::sin(10.0 *_t+10.0/49.0)+206.0/61.0 *f32::sin(11.0 *_t+106.0/29.0)+65.0/14.0 *f32::sin(12.0 *_t+81.0/29.0)+80.0/11.0 *f32::sin(13.0 *_t+49.0/43.0)+41.0/29.0 *f32::sin(14.0 *_t+1.0/114.0)+17.0/38.0 *f32::sin(15.0 *_t+97.0/43.0)+97.0/20.0 *f32::sin(17.0 *_t+98.0/23.0)+77.0/30.0 *f32::sin(18.0 *_t+49.0/19.0)+44.0/13.0 *f32::sin(19.0 *_t+53.0/16.0)+44.0/19.0 *f32::sin(20.0 *_t+95.0/23.0)+135.0/29.0 *f32::sin(22.0 *_t+27.0/25.0)+243.0/121.0 *f32::sin(23.0 *_t+23.0/17.0)+15.0/4.0 *f32::sin(25.0 *_t+10.0/17.0)+50.0/13.0 *f32::sin(26.0 *_t+75.0/32.0)+308.0/47.0 *f32::sin(27.0 *_t+253.0/76.0)+65.0/19.0 *f32::sin(31.0 *_t+7.0/15.0)+92.0/33.0 *f32::sin(32.0 *_t+26.0/11.0)+17.0/15.0 *f32::sin(33.0 *_t+74.0/23.0)+8.0/15.0 *f32::sin(34.0 *_t+64.0/27.0)+17.0/27.0 *f32::sin(35.0 *_t+215.0/72.0)+16757.0/30.0) *theta(15.0 *pi-_t) *theta(_t-11.0 *pi)+(1805.0/16.0 *f32::sin(_t+1.0/303.0)+19936.0/43.0) *theta(11.0 *pi-_t) *theta(_t-7.0 *pi)+(374.0/65.0 *f32::sin(_t+149.0/47.0)+11537.0/27.0) *theta(7.0 *pi-_t) *theta(_t-3.0 *pi)+(-15391.0/135.0 *f32::sin(35.0/71.0-_t)+112.0/53.0 *f32::sin(2.0 *_t+66.0/29.0)+13507.0/30.0) *theta(3.0 *pi-_t) *theta(_t+pi)) *theta(f32::sqrt(f32::signum(f32::sin(_t/2.0))));
            vector[i as usize].z = 0.0;
            let _t = _t + 0.01;
        }
    }
    

    and the calling thinbasic code:
    Uses "TBGL"
    Uses "math"
    
    #default declare checkMissing true                        ' Useful to catch errors in testing phase
    
    $RUST_INTEROP_DLL = "..\target\release\rust_interop.dll"  ' Hehe, this is here just for comfort, in production
                                                              ' version the path is not needed, just lay the DLL
    
    type RgbColor
      r as byte
      g as byte
      b as byte
    end type
    
    
    type Vector3D
      x as single
      y as single
      z as single
     
    end type
    
    
    declare function UDTVector3DArray  lib $RUST_INTEROP_DLL alias "UDTVector3DArray" (byval v() as Vector3D, byval count as long)
    
    
    function tbMain()
     
      dim col as RgbColor
      with col
        .r = 255
        .g = 128
        .b = 64
      end with
     
      Local hWnd      As DWord
      Local FrameRate As Double
       
      ' -- Create and show window
      hWnd = TBGL_CreateWindowEx("Plotting 3D Data in an array using GBuffers- Calculate with Rust dll..Esc to quit", 600, 600, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX) 
      TBGL_ShowWindow  
       
      TBGL_BackColor 255,255,255 
      'TBGL_SetDrawDistance 250
     
      ' -- Create 3D points buffer
      DWord gbPoints = TBGL_GBufferCreate(%TBGL_POINTS, %TBGL_3D)
        
      Global Nb As DWord = 22619 ' 72*pi/0.01
      Global arr(Nb) As Vector3D 'TBGL_TVECTOR3F ' single
      'Global ColorB(Nb)  As TBGL_TRGB      ' Byte
      Global ColorB(Nb)  As RgbColor 
      long i
      for i = 1 to 22619
      ColorB(i).r = 255
      ColorB(i).g = 0
      ColorB(i).b = 0
      next
      
      
      UDTVector3DArray(arr(1), 22619)
      'msgbox(0, str$(arr(1000)))
      'msgbox(0, str$(CountOf(arr)))
    '   ' -- Create buffer dynamically linked to the arrays above
      TBGL_GBufferDefineFromArray(gbPoints, %TBGL_DYNAMIC, CountOf(arr), arr(1), ColorB(1))
      ' -- Resets status of all keys 
      TBGL_ResetKeyState()
      TBGL_PointSize 2
      
      ' -- Main loop
      While TBGL_IsWindow(hWnd)
      'init 
        FrameRate = TBGL_GetFrameRate
        
        TBGL_ClearFrame
          TBGL_Camera(0, 0, 90, 0, 0, 0)
           
          ' -- Turn triangle
          TBGL_Rotate GetTickCount/50, 0, 1, 0
          TBGL_Scale 0.03, 0.03, 0.03
                                         
          ' -- Render it                              
          TBGL_GBufferRender(gbPoints)   
            
        TBGL_DrawFrame
     
        ' -- ESCAPE key to exit application
        If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
     
      Wend        
      ' -- Destroying the buffer is not necessary,
      ' -- the garbage collector will take care of it
     
      ' -- Destroy window
      TBGL_DestroyWindow
    End Function
    
    Last edited by primo; 23-07-2018 at 11:21.

  4. #14
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Primo,

    you were really close! Great job on Rustifiying

    I think the main issue is related to your handling of t variable.

    Instead of this:
    let _t: f32 = 0.0;
    
    it should be declared like this:
    let mut _t: f32 = 0.0;
    
    Why? Because you want _t to change its value over time. Specifying mut means it is mutable, changeable.

    Other minor tweak can be done with:
    let _t = _t + 0.01;
    
    You are basically re-declaring (shadowing) the original _t here.

    Change it simply to:
     _t = _t + 0.01;
    
    This was not possible before, because your _t was not mutable.

    Can be further tweaked as:
     _t += 0.01;
    
    Other minor tweaks:


    • no need to define custom pi, Rust has it for you as ::std::f32::consts::PI
    • no need to have t as _t - I guess Rust adviced this, because he detected it is not used, thanks to the accidental shadowing (and here is from where the zeros came)
    • the theta function does not need to be pub, pub means the functions is public (visible from code file), neither extern (you don't call it from DLL). #[no_mangle] means "do not change the name in the final DLL", so it is not needed either


    Your Rust side then becomes:
    fn theta(a: f32) -> f32 {    
        if a <= 0.0 {
          0.0    
        } 
        else {
          1.0  
        }
    }
     
    #[no_mangle]
    pub extern fn UDTVector3DArray(vector_ptr: *mut Vector3D, count: i32) {
        let pi: f32 = ::std::f32::consts::PI;
    
    
        // Converting pointer to so called slice, the _mut allows us to write
        let vector = unsafe { ::std::slice::from_raw_parts_mut(vector_ptr, count as usize) };
        let mut t: f32 = 0.0;
    
    
        // Writing new values
        for i in 0..count {
            vector[i as usize].x = ((-5.0/37.0 *f32::sin(61.0/42.0-8.0 *t)-112.0/41.0 *f32::sin(36.0/23.0-7.0 *t)-62.0/37.0 *f32::sin(14.0/9.0-6.0 *t)-31.0/7.0 *f32::sin(69.0/44.0-5.0 *t)-275.0/13.0 *f32::sin(47.0/30.0-3.0 *t)-23.0/38.0 *f32::sin(48.0/31.0-2.0 *t)+461.0/10.0 *f32::sin(t+107.0/68.0)+8.0/23.0 *f32::sin(4.0 *t+179.0/38.0)-2345.0/18.0)*theta(71.0 *pi-t) *theta(t-67.0 *pi)+(-41.0/74.0 *f32::sin(112.0/75.0-17.0 *t)-274.0/37.0 *f32::sin(17.0/11.0-11.0 *t)-907.0/30.0 *f32::sin(36.0/23.0-5.0 *t)+623.0/15.0 *f32::sin(t+47.0/30.0)+684.0/29.0 *f32::sin(2.0 *t+212.0/45.0)+3864.0/25.0 *f32::sin(3.0 *t+63.0/40.0)+1513.0/78.0 *f32::sin(4.0 *t+19.0/12.0)+269.0/45.0 *f32::sin(6.0 *t+14.0/9.0)+66.0/25.0 *f32::sin(7.0 *t+155.0/33.0)+121.0/35.0 *f32::sin(8.0 *t+27.0/17.0)+44.0/13.0 *f32::sin(9.0 *t+35.0/22.0)+71.0/7.0 *f32::sin(10.0 *t+30.0/19.0)+87.0/40.0 *f32::sin(12.0 *t+57.0/37.0)+61.0/62.0 *f32::sin(13.0 *t+47.0/28.0)+43.0/65.0 *f32::sin(14.0 *t+31.0/20.0)+54.0/37.0 *f32::sin(15.0 *t+127.0/27.0)+56.0/27.0 *f32::sin(16.0 *t+30.0/19.0)+11843.0/35.0) *theta(67.0 *pi-t) *theta(t-63.0 *pi)+(-119.0/55.0 *f32::sin(65.0/43.0-13.0 *t)-78.0/11.0 *f32::sin(82.0/55.0-12.0 *t)-25.0/31.0 *f32::sin(36.0/23.0-11.0 *t)-70.0/9.0 *f32::sin(31.0/20.0-9.0 *t)-707.0/65.0 *f32::sin(47.0/30.0-7.0 *t)-953.0/22.0*f32::sin(45.0/29.0-5.0 *t)+962.0/15.0 *f32::sin(t+113.0/72.0)+1091.0/30.0 *f32::sin(2.0 *t+212.0/45.0)+3177.0/26.0 *f32::sin(3.0 *t+27.0/17.0)+1685.0/22.0 *f32::sin(4.0 *t+43.0/27.0)+143.0/27.0 *f32::sin(6.0 *t+49.0/32.0)+203.0/27.0 *f32::sin(8.0 *t+27.0/17.0)+411.0/37.0 *f32::sin(10.0 *t+50.0/31.0)+65.0/27.0 *f32::sin(14.0 *t+33.0/20.0)+8.0/19.0 *f32::sin(15.0 *t+13.0/7.0)+3.0/11.0 *f32::sin(16.0 *t+43.0/33.0)-11597.0/35.0) *theta(63.0 *pi-t) *theta(t-59.0 *pi)+(-1.0/7.0 *f32::sin(41.0/81.0-30.0 *t)-8.0/27.0 *f32::sin(3.0/28.0-28.0 *t)-10.0/23.0 *f32::sin(3.0/26.0-26.0 *t)+2377.0/13.0 *f32::sin(t+33.0/28.0)+43.0/15.0 *f32::sin(2.0 *t+26.0/7.0)+131.0/18.0 *f32::sin(3.0 *t+3.0/25.0)+45.0/41.0 *f32::sin(4.0 *t+105.0/32.0)+43.0/14.0 *f32::sin(5.0 *t+87.0/23.0)+135.0/136.0 *f32::sin(6.0 *t+51.0/20.0)+51.0/14.0 *f32::sin(7.0 *t+118.0/43.0)+19.0/18.0 *f32::sin(8.0 *t+23.0/18.0)+49.0/23.0 *f32::sin(9.0 *t+25.0/12.0)+14.0/19.0 *f32::sin(10.0 *t+63.0/55.0)+54.0/49.0 *f32::sin(11.0 *t+68.0/41.0)+32.0/37.0 *f32::sin(12.0 *t+30.0/29.0)+5.0/12.0 *f32::sin(13.0 *t+43.0/24.0)+34.0/45.0 *f32::sin(14.0 *t+15.0/17.0)+13.0/30.0 *f32::sin(15.0 *t+67.0/23.0)+21.0/31.0 *f32::sin(16.0 *t+43.0/60.0)+25.0/62.0 *f32::sin(17.0 *t+89.0/34.0)+9.0/20.0 *f32::sin(18.0 *t+11.0/26.0)+4.0/17.0 *f32::sin(19.0 *t+55.0/28.0)+26.0/51.0 *f32::sin(20.0 *t+4.0/17.0)+2.0/33.0 *f32::sin(21.0 *t+247.0/62.0)+14.0/31.0 *f32::sin(22.0 *t+9.0/44.0)+5.0/26.0 *f32::sin(23.0 *t+113.0/34.0)+9.0/17.0 *f32::sin(24.0 *t+3.0/10.0)+4.0/25.0 *f32::sin(25.0 *t+99.0/32.0)+6.0/23.0 *f32::sin(27.0 *t+548.0/183.0)+10.0/33.0 *f32::sin(29.0 *t+129.0/37.0)+5.0/12.0 *f32::sin(31.0 *t+127.0/39.0)-9719.0/87.0) *theta(59.0 *pi-t) *theta(t-55.0 *pi)+(228.0/65.0 *f32::sin(t+116.0/33.0)+353.0/40.0 *f32::sin(2.0 *t+33.0/19.0)+107.0/24.0 *f32::sin(3.0 *t+58.0/33.0)+58.0/21.0 *f32::sin(4.0 *t+519.0/130.0)+19.0/15.0 *f32::sin(5.0 *t+45.0/37.0)+13.0/12.0 *f32::sin(6.0 *t+145.0/38.0)+43.0/42.0 *f32::sin(7.0 *t+25.0/99.0)+11.0/19.0 *f32::sin(8.0 *t+105.0/44.0)+203.0/19.0) *theta(55.0 *pi-t) *theta(t-51.0 *pi)+(-23.0/10.0*f32::sin(22.0/17.0-4.0 *t)-159.0/17.0 *f32::sin(156.0/125.0-3.0 *t)+523.0/112.0 *f32::sin(t+80.0/21.0)+111.0/23.0 *f32::sin(2.0 *t+25.0/24.0)+92.0/79.0 *f32::sin(5.0 *t+57.0/32.0)+58.0/37.0 *f32::sin(6.0 *t+159.0/35.0)+18.0/31.0 *f32::sin(7.0 *t+27.0/43.0)-7563.0/28.0) *theta(51.0 *pi-t) *theta(t-47.0 *pi)+(-76.0/17.0 *f32::sin(42.0/41.0-14.0 *t)-154.0/31.0 *f32::sin(37.0/38.0-11.0 *t)+10820.0/41.0 *f32::sin(t+25.0/34.0)+1476.0/31.0 *f32::sin(2.0 *t+36.0/19.0)+595.0/12.0 *f32::sin(3.0 *t+67.0/43.0)+3568.0/67.0 *f32::sin(4.0 *t+282.0/77.0)+974.0/59.0 *f32::sin(5.0 *t+40.0/19.0)+427.0/18.0 *f32::sin(6.0 *t+47.0/25.0)+454.0/23.0 *f32::sin(7.0 *t+20.0/27.0)+41.0/40.0 *f32::sin(8.0 *t+9.0/2.0)+139.0/22.0 *f32::sin(9.0 *t+99.0/26.0)+276.0/37.0 *f32::sin(10.0 *t+37.0/29.0)+113.0/25.0 *f32::sin(12.0 *t+61.0/30.0)+37.0/29.0 *f32::sin(13.0 *t+37.0/31.0)+51.0/19.0 *f32::sin(15.0 *t+127.0/34.0)+115.0/72.0 *f32::sin(16.0 *t+7.0/38.0)+162.0/43.0 *f32::sin(17.0 *t+67.0/21.0)+26.0/33.0 *f32::sin(18.0 *t+194.0/45.0)-3614.0/99.0) *theta(47.0 *pi-t) *theta(t-43.0 *pi)+(347.0/17.0 *f32::sin(t+3.0/13.0)+9951.0/41.0) *theta(43.0 *pi-t) *theta(t-39.0 *pi)+(760.0/29.0 *f32::sin(t+23.0/25.0)-6059.0/28.0)*theta(39.0 *pi-t) *theta(t-35.0 *pi)+(-106.0/41.0 *f32::sin(7.0/13.0-18.0 *t)-55.0/38.0 *f32::sin(13.0/29.0-16.0 *t)-173.0/19.0 *f32::sin(34.0/29.0-7.0 *t)-484.0/31.0 *f32::sin(13.0/16.0-5.0 *t)-1193.0/17.0 *f32::sin(97.0/83.0-2.0 *t)+6885.0/26.0 *f32::sin(t+41.0/48.0)+99.0/5.0 *f32::sin(3.0 *t+5.0/16.0)+751.0/36.0 *f32::sin(4.0 *t+73.0/18.0)+129.0/40.0 *f32::sin(6.0 *t+83.0/18.0)+327.0/31.0 *f32::sin(8.0 *t+17.0/23.0)+498.0/47.0 *f32::sin(9.0 *t+123.0/88.0)+298.0/49.0 *f32::sin(10.0 *t+54.0/25.0)+82.0/15.0 *f32::sin(11.0 *t+153.0/35.0)+106.0/27.0 *f32::sin(12.0 *t+3.0/32.0)+171.0/43.0 *f32::sin(13.0 *t+433.0/173.0)+36.0/11.0 *f32::sin(14.0 *t+98.0/33.0)+39.0/22.0 *f32::sin(15.0 *t+97.0/25.0)+68.0/37.0 *f32::sin(17.0 *t+157.0/34.0)-227.0/29.0) *theta(35.0 *pi-t) *theta(t-31.0 *pi)+(-2.0/15.0 *f32::sin(66.0/47.0-14.0 *t)-45.0/23.0 *f32::sin(5.0/9.0-11.0 *t)-151.0/43.0 *f32::sin(13.0/32.0-8.0 *t)-31.0/36.0 *f32::sin(24.0/19.0-7.0 *t)+2121.0/32.0 *f32::sin(t+45.0/38.0)+2085.0/47.0 *f32::sin(2.0 *t+299.0/88.0)+1321.0/43.0 *f32::sin(3.0 *t+72.0/25.0)+557.0/37.0 *f32::sin(4.0 *t+74.0/21.0)+205.0/17.0 *f32::sin(5.0 *t+27.0/23.0)+13.0/9.0 *f32::sin(6.0 *t+113.0/32.0)+35.0/17.0 *f32::sin(9.0 *t+7.0/22.0)+93.0/26.0 *f32::sin(10.0 *t+112.0/25.0)+11.0/14.0 *f32::sin(12.0 *t+58.0/17.0)+8.0/15.0 *f32::sin(13.0 *t+47.0/30.0)+33.0/20.0 *f32::sin(15.0 *t+32.0/25.0)+31.0/94.0 *f32::sin(16.0 *t+192.0/59.0)+35.0/31.0 *f32::sin(17.0 *t+51.0/77.0)+9473.0/34.0) *theta(31.0 *pi-t) *theta(t-27.0 *pi)+(-33.0/29.0 *f32::sin(27.0/55.0-12.0 *t)+388.0/13.0 *f32::sin(t+5.0/13.0)+2087.0/30.0 *f32::sin(2.0 *t+193.0/55.0)+1311.0/49.0 *f32::sin(3.0 *t+133.0/30.0)+993.0/41.0 *f32::sin(4.0 *t+134.0/31.0)+175.0/17.0 *f32::sin(5.0 *t+73.0/29.0)+83.0/23.0 *f32::sin(6.0 *t+28.0/33.0)+9.0/19.0 *f32::sin(7.0 *t+73.0/36.0)+101.0/32.0 *f32::sin(8.0 *t+57.0/28.0)+51.0/25.0 *f32::sin(9.0 *t+106.0/39.0)+47.0/28.0 *f32::sin(10.0 *t+129.0/47.0)+17.0/29.0 *f32::sin(11.0 *t+33.0/17.0)+27.0/22.0 *f32::sin(13.0 *t+155.0/86.0)+108.0/65.0 *f32::sin(14.0 *t+8.0/27.0)+9.0/16.0 *f32::sin(15.0 *t+44.0/13.0)+11.0/14.0 *f32::sin(16.0 *t+3.0/19.0)+11.0/23.0 *f32::sin(17.0 *t+106.0/23.0)+9.0/64.0 *f32::sin(18.0 *t+97.0/22.0)-10004.0/35.0) *theta(27.0 *pi-t) *theta(t-23.0 *pi)+(-18.0/13.0 *f32::sin(7.0/50.0-18.0 *t)-7.0/5.0 *f32::sin(1.0/10.0-16.0 *t)-51.0/25.0 *f32::sin(18.0/19.0-12.0 *t)-219.0/35.0 *f32::sin(7.0/30.0-10.0 *t)-158.0/43.0 *f32::sin(40.0/37.0-6.0 *t)-512.0/25.0 *f32::sin(13.0/16.0-4.0 *t)-289.0/29.0 *f32::sin(68.0/67.0-2.0 *t)+18315.0/101.0 *f32::sin(t+29.0/18.0)+664.0/31.0 *f32::sin(3.0 *t+61.0/23.0)+48.0/11.0 *f32::sin(5.0 *t+84.0/67.0)+489.0/49.0 *f32::sin(7.0 *t+11.0/25.0)+397.0/33.0 *f32::sin(8.0 *t+8.0/19.0)+73.0/12.0 *f32::sin(9.0 *t+9.0/53.0)+194.0/41.0 *f32::sin(11.0 *t+17.0/14.0)+2.0/3.0 *f32::sin(13.0 *t+149.0/50.0)+43.0/29.0 *f32::sin(14.0 *t+91.0/31.0)+61.0/35.0*f32::sin(15.0 *t+131.0/56.0)+29.0/37.0 *f32::sin(17.0 *t+1.0/19.0)+49.0/43.0 *f32::sin(19.0 *t+65.0/24.0)+15.0/19.0 *f32::sin(20.0 *t+88.0/21.0)+11.0/38.0 *f32::sin(21.0 *t+217.0/50.0)+3917.0/10.0) *theta(23.0 *pi-t) *theta(t-19.0 *pi)+(-8.0/9.0 *f32::sin(12.0/23.0-16.0 *t)-504.0/53.0 *f32::sin(8.0/29.0-8.0 *t)-635.0/43.0 *f32::sin(32.0/37.0-4.0 *t)-307.0/41.0 *f32::sin(8.0/27.0-3.0 *t)-20292.0/91.0 *f32::sin(16.0/19.0-t)+483.0/19.0 *f32::sin(2.0 *t+41.0/13.0)+108.0/23.0 *f32::sin(5.0 *t+70.0/29.0)+74.0/35.0 *f32::sin(6.0 *t+145.0/34.0)+287.0/43.0 *f32::sin(7.0 *t+69.0/16.0)+254.0/39.0 *f32::sin(9.0 *t+5.0/27.0)+19.0/4.0 *f32::sin(10.0 *t+37.0/30.0)+129.0/46.0 *f32::sin(11.0 *t+75.0/32.0)+24.0/19.0 *f32::sin(12.0 *t+71.0/46.0)+125.0/52.0 *f32::sin(13.0 *t+87.0/44.0)+46.0/27.0 *f32::sin(14.0 *t+40.0/31.0)+26.0/29.0 *f32::sin(15.0 *t+106.0/27.0)+25.0/63.0 *f32::sin(17.0 *t+53.0/12.0)+23.0/22.0 *f32::sin(18.0 *t+9.0/29.0)+3.0/35.0 *f32::sin(19.0 *t+205.0/103.0)+200.0/201.0 *f32::sin(20.0 *t+22.0/25.0)+8.0/31.0 *f32::sin(21.0 *t+77.0/25.0)-15195.0/29.0) *theta(19.0 *pi-t) *theta(t-15.0 *pi)+(-15.0/23.0 *f32::sin(22.0/23.0-35.0 *t)-21.0/26.0 *f32::sin(13.0/40.0-30.0 *t)-71.0/64.0 *f32::sin(16.0/19.0-29.0 *t)-97.0/29.0 *f32::sin(15.0/41.0-23.0 *t)-57.0/17.0 *f32::sin(54.0/35.0-16.0 *t)-79.0/25.0 *f32::sin(41.0/39.0-14.0 *t)-24.0/11.0 *f32::sin(3.0/8.0-13.0 *t)-149.0/17.0 *f32::sin(21.0/62.0-6.0 *t)-613.0/31.0 *f32::sin(16.0/17.0-2.0 *t)+6033.0/20.0 *f32::sin(t+24.0/17.0)+631.0/16.0 *f32::sin(3.0 *t+127.0/30.0)+463.0/31.0 *f32::sin(4.0 *t+71.0/28.0)+94.0/23.0 *f32::sin(5.0 *t+98.0/25.0)+45.0/11.0 *f32::sin(7.0 *t+31.0/10.0)+39.0/23.0 *f32::sin(8.0 *t+163.0/39.0)+23.0/22.0 *f32::sin(9.0 *t+42.0/17.0)+167.0/44.0 *f32::sin(10.0 *t+232.0/231.0)+233.0/49.0 *f32::sin(11.0 *t+29.0/45.0)+194.0/129.0 *f32::sin(12.0 *t+3.0/5.0)+166.0/37.0 *f32::sin(15.0 *t+83.0/29.0)+123.0/35.0 *f32::sin(17.0 *t+136.0/35.0)+47.0/26.0 *f32::sin(18.0 *t+64.0/25.0)+72.0/35.0 *f32::sin(19.0 *t+41.0/14.0)+56.0/31.0 *f32::sin(20.0 *t+48.0/35.0)+63.0/25.0 *f32::sin(21.0 *t+2.0/5.0)+100.0/37.0 *f32::sin(22.0 *t+13.0/15.0)+4.0/3.0 *f32::sin(24.0 *t+59.0/19.0)+17.0/25.0 *f32::sin(25.0 *t+15.0/38.0)+51.0/19.0 *f32::sin(26.0 *t+68.0/19.0)+11.0/27.0 *f32::sin(27.0 *t+228.0/91.0)+19.0/14.0 *f32::sin(28.0 *t+31.0/9.0)+4.0/13.0 *f32::sin(31.0 *t+14.0/55.0)+31.0/37.0 *f32::sin(32.0 *t+2.0/31.0)+150.0/151.0*f32::sin(33.0 *t+58.0/21.0)+41.0/32.0 *f32::sin(34.0 *t+26.0/11.0)+4.0/3.0 *f32::sin(36.0 *t+25.0/18.0)-6956.0/53.0) *theta(15.0 *pi-t) *theta(t-11.0 *pi)+(4337.0/36.0 *f32::sin(t+45.0/29.0)+265.0/18.0) *theta(11.0 *pi-t) *theta(t-7.0 *pi)+(-23.0/21.0 *f32::sin(31.0/61.0-t)-1152.0/11.0) *theta(7.0 *pi-t) *theta(t-3.0*pi)+(3314.0/27.0 *f32::sin(t+30.0/31.0)+65.0/31.0 *f32::sin(2.0 *t+26.0/23.0)-1467.0/5.0) *theta(3.0 *pi-t) *theta(t+pi)) *theta(f32::sqrt(f32::signum(f32::sin(t/2.0))));
            vector[i as usize].y = ((-9.0/23.0 *f32::sin(38.0/25.0-6.0 *t)-67.0/38.0 *f32::sin(36.0/23.0-3.0 *t)+31.0/30.0 *f32::sin(t+14.0/9.0)+409.0/9.0 *f32::sin(2.0 *t+74.0/47.0)+493.0/141.0 *f32::sin(4.0 *t+85.0/54.0)+14.0/17.0 *f32::sin(5.0 *t+75.0/16.0)+5.0/46.0 *f32::sin(7.0 *t+21.0/13.0)+33.0/23.0 *f32::sin(8.0 *t+74.0/47.0)+14536.0/41.0) *theta(71.0 *pi-t) *theta(t-67.0 *pi)+(-89.0/29.0 *f32::sin(59.0/38.0-17.0 *t)-5.0/11.0 *f32::sin(14.0/9.0-16.0 *t)-99.0/40.0 *f32::sin(58.0/37.0-15.0 *t)-59.0/7.0 *f32::sin(25.0/16.0-11.0 *t)-2.0/35.0 *f32::sin(8.0/41.0-10.0 *t)-381.0/26.0*f32::sin(25.0/16.0-9.0 *t)-67.0/21.0 *f32::sin(17.0/11.0-8.0 *t)-1706.0/37.0 *f32::sin(36.0/23.0-5.0 *t)-29.0/9.0 *f32::sin(29.0/19.0-4.0 *t)-851.0/29.0 *f32::sin(58.0/37.0-3.0 *t)+1991.0/30.0 *f32::sin(t+96.0/61.0)+528.0/17.0 *f32::sin(2.0 *t+85.0/54.0)+89.0/67.0 *f32::sin(6.0 *t+37.0/24.0)+102.0/13.0 *f32::sin(7.0 *t+80.0/17.0)+17.0/16.0 *f32::sin(12.0 *t+91.0/58.0)+35.0/12.0 *f32::sin(13.0 *t+37.0/23.0)+127.0/27.0 *f32::sin(14.0 *t+27.0/17.0)-26576.0/29.0) *theta(67.0 *pi-t) *theta(t-63.0 *pi)+(-29.0/14.0 *f32::sin(47.0/33.0-16.0 *t)-35.0/22.0 *f32::sin(75.0/52.0-15.0 *t)-236.0/63.0 *f32::sin(16.0/11.0-14.0 *t)-41.0/6.0 *f32::sin(34.0/23.0-13.0 *t)-236.0/29.0 *f32::sin(46.0/31.0-12.0 *t)-167.0/28.0 *f32::sin(55.0/37.0-11.0 *t)-259.0/33.0 *f32::sin(76.0/51.0-10.0 *t)-414.0/73.0 *f32::sin(56.0/37.0-9.0 *t)-121.0/28.0 *f32::sin(17.0/11.0-7.0 *t)-177.0/32.0 *f32::sin(61.0/41.0-6.0 *t)-1499.0/41.0 *f32::sin(48.0/31.0-5.0 *t)-647.0/23.0 *f32::sin(25.0/16.0-3.0 *t)+610.0/13.0 *f32::sin(t+30.0/19.0)+1474.0/31.0 *f32::sin(2.0 *t+30.0/19.0)+807.0/41.0 *f32::sin(4.0 *t+41.0/26.0)+208.0/31.0 *f32::sin(8.0 *t+43.0/27.0)-16147.0/17.0) *theta(63.0 *pi-t) *theta(t-59.0 *pi)+(-12.0/41.0 *f32::sin(1.0/4.0-28.0 *t)-11.0/43.0 *f32::sin(9.0/14.0-26.0 *t)-17.0/41.0 *f32::sin(14.0/13.0-24.0 *t)-22.0/31.0 *f32::sin(17.0/67.0-22.0 *t)-7.0/10.0 *f32::sin(64.0/63.0-19.0 *t)-69.0/41.0 *f32::sin(39.0/31.0-14.0 *t)-86.0/25.0 *f32::sin(22.0/41.0-12.0 *t)-87.0/52.0 *f32::sin(31.0/27.0-9.0 *t)-23.0/15.0 *f32::sin(13.0/33.0-7.0 *t)-25.0/17.0 *f32::sin(22.0/25.0-3.0 *t)+159.0/28.0 *f32::sin(t+249.0/248.0)+571.0/20.0 *f32::sin(2.0 *t+23.0/26.0)+109.0/36.0 *f32::sin(4.0 *t+29.0/18.0)+161.0/58.0 *f32::sin(5.0 *t+31.0/23.0)+147.0/26.0 *f32::sin(6.0 *t+31.0/19.0)+199.0/35.0 *f32::sin(8.0 *t+37.0/42.0)+96.0/19.0 *f32::sin(10.0 *t+17.0/47.0)+64.0/27.0 *f32::sin(11.0 *t+337.0/75.0)+15.0/7.0 *f32::sin(13.0 *t+157.0/44.0)+f32::sin(15.0 *t+101.0/33.0)+5.0/38.0 *f32::sin(16.0 *t+1.0/28.0)+11.0/56.0 *f32::sin(17.0 *t+23.0/37.0)+6.0/11.0 *f32::sin(18.0 *t+8.0/9.0)+91.0/136.0 *f32::sin(20.0 *t+3.0/19.0)+55.0/54.0 *f32::sin(21.0 *t+102.0/25.0)+15.0/16.0 *f32::sin(23.0*t+118.0/31.0)+22.0/27.0 *f32::sin(25.0 *t+49.0/15.0)+3.0/8.0 *f32::sin(27.0 *t+27.0/8.0)+22.0/43.0 *f32::sin(29.0 *t+57.0/16.0)+10.0/19.0 *f32::sin(30.0 *t+50.0/83.0)+5.0/31.0 *f32::sin(31.0 *t+121.0/38.0)+2727.0/23.0) *theta(59.0 *pi-t) *theta(t-55.0 *pi)+(-41.0/31.0 *f32::sin(23.0/21.0-4.0 *t)-85.0/14.0 *f32::sin(17.0/32.0-t)+407.0/35.0 *f32::sin(2.0 *t+75.0/22.0)+21.0/10.0 *f32::sin(3.0 *t+41.0/14.0)+53.0/54.0 *f32::sin(5.0 *t+54.0/25.0)+31.0/61.0 *f32::sin(6.0 *t+124.0/27.0)+5.0/36.0 *f32::sin(7.0 *t+3.0/19.0)+19.0/31.0 *f32::sin(8.0 *t+144.0/31.0)+10393.0/23.0) *theta(55.0 *pi-t) *theta(t-51.0 *pi)+(-36.0/41.0 *f32::sin(5.0/18.0-6.0 *t)+83.0/35.0 *f32::sin(t+95.0/28.0)+43.0/37.0 *f32::sin(2.0 *t+66.0/17.0)+165.0/13.0 *f32::sin(3.0 *t+27.0/53.0)+79.0/19.0 *f32::sin(4.0 *t+9.0/17.0)+37.0/24.0 *f32::sin(5.0 *t+190.0/63.0)+57.0/58.0 *f32::sin(7.0 *t+267.0/100.0)+13545.0/31.0) *theta(51.0 *pi-t) *theta(t-47.0 *pi)+(-123.0/47.0 *f32::sin(19.0/15.0-18.0 *t)-59.0/29.0 *f32::sin(1.0/49.0-16.0 *t)-213.0/37.0 *f32::sin(29.0/22.0-13.0 *t)-381.0/40.0 *f32::sin(4.0/29.0-11.0 *t)-168.0/29.0 *f32::sin(6.0/11.0-10.0 *t)-1233.0/44.0 *f32::sin(3.0/19.0-3.0 *t)-711.0/7.0 *f32::sin(1.0/39.0-2.0 *t)-5171.0/26.0 *f32::sin(12.0/19.0-t)+2965.0/57.0 *f32::sin(4.0 *t+89.0/28.0)+347.0/21.0 *f32::sin(5.0 *t+23.0/93.0)+1087.0/69.0 *f32::sin(6.0 *t+4.0/31.0)+760.0/37.0 *f32::sin(7.0 *t+172.0/53.0)+333.0/19.0 *f32::sin(8.0 *t+7.0/13.0)+325.0/81.0 *f32::sin(9.0 *t+96.0/55.0)+53.0/17.0 *f32::sin(12.0 *t+138.0/49.0)+73.0/40.0 *f32::sin(14.0 *t+92.0/67.0)+47.0/31.0 *f32::sin(15.0 *t+81.0/19.0)+7.0/11.0*f32::sin(17.0 *t+29.0/30.0)-3017.0/19.0) *theta(47.0 *pi-t) *theta(t-43.0 *pi)+(-713.0/27.0 *f32::sin(22.0/17.0-t)-36840.0/41.0) *theta(43.0 *pi-t) *theta(t-39.0 *pi)+(-675.0/23.0 *f32::sin(13.0/16.0-t)-17750.0/19.0) *theta(39.0 *pi-t) *theta(t-35.0 *pi)+(-39.0/29.0 *f32::sin(11.0/16.0-17.0 *t)-102.0/37.0 *f32::sin(8.0/49.0-11.0 *t)-95.0/34.0 *f32::sin(4.0/13.0-9.0 *t)-71.0/22.0 *f32::sin(7.0/12.0-8.0 *t)-194.0/17.0 *f32::sin(29.0/23.0-7.0 *t)-2531.0/25.0 *f32::sin(13.0/36.0-t)+601.0/19.0 *f32::sin(2.0 *t+264.0/61.0)+232.0/5.0 *f32::sin(3.0 *t+53.0/13.0)+309.0/40.0 *f32::sin(4.0 *t+29.0/10.0)+266.0/39.0 *f32::sin(5.0 *t+3.0/16.0)+71.0/95.0 *f32::sin(6.0 *t+50.0/37.0)+281.0/44.0 *f32::sin(10.0 *t+33.0/43.0)+29.0/15.0 *f32::sin(12.0 *t+105.0/29.0)+39.0/25.0 *f32::sin(13.0 *t+109.0/36.0)+24.0/11.0 *f32::sin(14.0 *t+51.0/38.0)+19.0/9.0 *f32::sin(15.0 *t+38.0/23.0)+43.0/29.0 *f32::sin(16.0 *t+4.0)+53.0/74.0 *f32::sin(18.0 *t+74.0/25.0)-45956.0/91.0)*theta(35.0 *pi-t) *theta(t-31.0 *pi)+(-25.0/32.0 *f32::sin(4.0/13.0-15.0 *t)-40.0/43.0 *f32::sin(11.0/19.0-13.0 *t)-12727.0/115.0 *f32::sin(83.0/84.0-t)+1762.0/31.0 *f32::sin(2.0 *t+66.0/29.0)+905.0/78.0 *f32::sin(3.0 *t+46.0/25.0)+209.0/25.0 *f32::sin(4.0 *t+104.0/37.0)+103.0/27.0 *f32::sin(5.0 *t+32.0/17.0)+121.0/60.0 *f32::sin(6.0 *t+143.0/37.0)+29.0/7.0 *f32::sin(7.0 *t+45.0/13.0)+41.0/36.0 *f32::sin(8.0 *t+271.0/58.0)+125.0/62.0 *f32::sin(9.0 *t+152.0/33.0)+118.0/79.0 *f32::sin(10.0 *t+56.0/25.0)+41.0/24.0 *f32::sin(11.0 *t+108.0/25.0)+22.0/45.0 *f32::sin(12.0 *t+116.0/41.0)+43.0/35.0 *f32::sin(14.0 *t+68.0/19.0)+1.0/15.0 *f32::sin(16.0 *t+26.0/11.0)+13.0/43.0 *f32::sin(17.0 *t+53.0/25.0)-29541.0/41.0) *theta(31.0 *pi-t) *theta(t-27.0 *pi)+(-235.0/21.0 *f32::sin(5.0/46.0-5.0 *t)-133.0/13.0 *f32::sin(3.0/29.0-4.0 *t)-437.0/37.0 *f32::sin(50.0/37.0-3.0 *t)-2785.0/19.0 *f32::sin(5.0/4.0-t)+724.0/17.0 *f32::sin(2.0 *t+68.0/29.0)+211.0/141.0 *f32::sin(6.0 *t+83.0/44.0)+41.0/14.0 *f32::sin(7.0 *t+135.0/32.0)+83.0/20.0 *f32::sin(8.0 *t+135.0/38.0)+123.0/62.0 *f32::sin(9.0 *t+136.0/33.0)+304.0/203.0 *f32::sin(10.0 *t+166.0/47.0)+59.0/44.0 *f32::sin(11.0 *t+5.0/29.0)+25.0/36.0 *f32::sin(12.0 *t+102.0/49.0)+13.0/12.0 *f32::sin(13.0 *t+101.0/41.0)+23.0/13.0 *f32::sin(14.0 *t+73.0/26.0)+5.0/32.0 *f32::sin(15.0 *t+85.0/27.0)+41.0/61.0 *f32::sin(16.0 *t+56.0/25.0)+1.0/7.0 *f32::sin(17.0 *t+10.0/17.0)+7.0/18.0 *f32::sin(18.0*t+134.0/51.0)-8059.0/11.0) *theta(27.0 *pi-t) *theta(t-23.0 *pi)+(-32.0/23.0 *f32::sin(20.0/27.0-18.0 *t)-31.0/20.0 *f32::sin(19.0/17.0-17.0 *t)-89.0/38.0 *f32::sin(30.0/23.0-13.0 *t)-529.0/122.0 *f32::sin(22.0/15.0-10.0 *t)-151.0/35.0 *f32::sin(2.0/27.0-8.0 *t)-417.0/28.0 *f32::sin(43.0/29.0-4.0 *t)-851.0/35.0 *f32::sin(3.0/14.0-3.0 *t)-13229.0/88.0 *f32::sin(31.0/52.0-t)+425.0/12.0 *f32::sin(2.0 *t+37.0/18.0)+397.0/30.0 *f32::sin(5.0 *t+37.0/17.0)+299.0/31.0 *f32::sin(6.0*t+122.0/41.0)+301.0/38.0 *f32::sin(7.0 *t+58.0/35.0)+240.0/43.0 *f32::sin(9.0 *t+118.0/27.0)+39.0/28.0 *f32::sin(11.0 *t+27.0/34.0)+82.0/165.0 *f32::sin(12.0 *t+58.0/27.0)+29.0/26.0 *f32::sin(14.0 *t+77.0/27.0)+47.0/19.0 *f32::sin(15.0 *t+7.0/4.0)+46.0/17.0 *f32::sin(16.0 *t+79.0/22.0)+46.0/35.0 *f32::sin(19.0 *t+43.0/21.0)+23.0/28.0 *f32::sin(20.0 *t+105.0/31.0)+27.0/23.0 *f32::sin(21.0 *t+184.0/41.0)-12036.0/55.0) *theta(23.0 *pi-t) *theta(t-19.0 *pi)+(-16.0/37.0 *f32::sin(42.0/43.0-19.0 *t)-21.0/23.0 *f32::sin(37.0/26.0-18.0 *t)-23.0/17.0 *f32::sin(25.0/56.0-17.0 *t)-46.0/61.0 *f32::sin(34.0/45.0-16.0 *t)-161.0/22.0 *f32::sin(1.0/2.0-6.0 *t)-472.0/43.0 *f32::sin(15.0/23.0-5.0 *t)-620.0/29.0 *f32::sin(43.0/60.0-3.0 *t)+2821.0/25.0 *f32::sin(t+167.0/39.0)+2605.0/88.0 *f32::sin(2.0 *t+89.0/30.0)+449.0/43.0 *f32::sin(4.0 *t+66.0/25.0)+37.0/24.0 *f32::sin(7.0 *t+37.0/33.0)+107.0/13.0 *f32::sin(8.0 *t+175.0/52.0)+341.0/128.0 *f32::sin(9.0 *t+188.0/41.0)+32.0/15.0 *f32::sin(10.0 *t+12.0/19.0)+208.0/43.0 *f32::sin(11.0 *t+44.0/73.0)+122.0/53.0 *f32::sin(12.0 *t+41.0/39.0)+69.0/40.0 *f32::sin(13.0 *t+9.0/32.0)+34.0/23.0 *f32::sin(14.0 *t+208.0/45.0)+19.0/11.0 *f32::sin(15.0 *t+11.0/36.0)+17.0/19.0 *f32::sin(20.0 *t+111.0/26.0)+4.0/15.0 *f32::sin(21.0 *t+26.0/25.0)-10055.0/37.0) *theta(19.0 *pi-t) *theta(t-15.0 *pi)+(-59.0/44.0 *f32::sin(173.0/172.0-36.0 *t)-73.0/31.0 *f32::sin(21.0/53.0-30.0 *t)-23.0/11.0 *f32::sin(13.0/12.0-29.0 *t)-133.0/50.0 *f32::sin(23.0/19.0-28.0 *t)-125.0/29.0 *f32::sin(108.0/77.0-24.0 *t)-122.0/33.0 *f32::sin(1.0/19.0-21.0 *t)-238.0/79.0 *f32::sin(4.0/7.0-16.0 *t)-141.0/16.0 *f32::sin(34.0/37.0-9.0 *t)-45.0/8.0 *f32::sin(16.0/27.0-7.0 *t)+11594.0/23.0 *f32::sin(t+1768.0/589.0)+1582.0/37.0 *f32::sin(2.0 *t+28.0/25.0)+771.0/38.0 *f32::sin(3.0 *t+107.0/31.0)+863.0/22.0 *f32::sin(4.0 *t+87.0/22.0)+485.0/29.0 *f32::sin(5.0 *t+63.0/25.0)+27.0/8.0 *f32::sin(6.0 *t+75.0/76.0)+106.0/19.0 *f32::sin(8.0 *t+20.0/23.0)+54.0/17.0 *f32::sin(10.0 *t+10.0/49.0)+206.0/61.0 *f32::sin(11.0 *t+106.0/29.0)+65.0/14.0 *f32::sin(12.0 *t+81.0/29.0)+80.0/11.0 *f32::sin(13.0 *t+49.0/43.0)+41.0/29.0 *f32::sin(14.0 *t+1.0/114.0)+17.0/38.0 *f32::sin(15.0 *t+97.0/43.0)+97.0/20.0 *f32::sin(17.0 *t+98.0/23.0)+77.0/30.0 *f32::sin(18.0 *t+49.0/19.0)+44.0/13.0 *f32::sin(19.0 *t+53.0/16.0)+44.0/19.0 *f32::sin(20.0 *t+95.0/23.0)+135.0/29.0 *f32::sin(22.0 *t+27.0/25.0)+243.0/121.0 *f32::sin(23.0 *t+23.0/17.0)+15.0/4.0 *f32::sin(25.0 *t+10.0/17.0)+50.0/13.0 *f32::sin(26.0 *t+75.0/32.0)+308.0/47.0 *f32::sin(27.0 *t+253.0/76.0)+65.0/19.0 *f32::sin(31.0 *t+7.0/15.0)+92.0/33.0 *f32::sin(32.0 *t+26.0/11.0)+17.0/15.0 *f32::sin(33.0 *t+74.0/23.0)+8.0/15.0 *f32::sin(34.0 *t+64.0/27.0)+17.0/27.0 *f32::sin(35.0 *t+215.0/72.0)+16757.0/30.0) *theta(15.0 *pi-t) *theta(t-11.0 *pi)+(1805.0/16.0 *f32::sin(t+1.0/303.0)+19936.0/43.0) *theta(11.0 *pi-t) *theta(t-7.0 *pi)+(374.0/65.0 *f32::sin(t+149.0/47.0)+11537.0/27.0) *theta(7.0 *pi-t) *theta(t-3.0 *pi)+(-15391.0/135.0 *f32::sin(35.0/71.0-t)+112.0/53.0 *f32::sin(2.0 *t+66.0/29.0)+13507.0/30.0) *theta(3.0 *pi-t) *theta(t+pi)) *theta(f32::sqrt(f32::signum(f32::sin(t/2.0))));
            vector[i as usize].z = 0.0;
            t += 0.01;
        }
    }
    
    With these changes, I see some neat pointed curves flying in the TBGL space


    Petr
    Last edited by Petr Schreiber; 23-07-2018 at 09:10.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #15
    you are Petr a Great Professor of Rust Programming Language somewhere !!. and your notes is very detailed and valuable not for me only but for any one trying to learn the language. Thank you very much.
    i got a big Simpson figure so i scaled it down by:
    TBGL_Scale 0.03, 0.03, 0.03
    this is the output of the thinbasic_Rust DLL :
    simpson.PNG
    the speed of displaying the graphics is very speedy.

    but who support the Rust project financially, certainly there is too much costs to run their servers, thousands of users is connecting at the same time to their servers downloading their code dependence and this is costly.

    Edit: i have found it : https://www.rust-lang.org/en-US/friends.html
    it is a lot of companies and organizations
    look also here: https://www.ibm.com/developerworks/l...ust/index.html
    can't believe i never heard about Rust until Petr mention it occasionally somewhere here, and then i have downloaded it as a one big offline, i was able to run 'hello world' and then i forget it ,after that when John posted the topic Tbo2 ?? i have suggested
    to Eros and Petr to develop thinbasic in Rust and then Eros provided the link to thinbasic Rust connection in GitHub
    the History works in a bizarre way
    Last edited by primo; 23-07-2018 at 13:56.

  6. #16
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Primo,

    congratulations on getting Bart to the screen!
    As your research suggests, Rust has grown incredibly since 2015, when the first official release was out First an hobby project of Mozilla developer, now Rust contributes to the new, fast Firefox core.
    Dropbox backend written in Rust. Npm using it...

    Rust and ThinBASIC do not compete, they nicely complement each other. ThinBASIC is perfect as day-to-day sidekick for string wrestling at work, and Rust is that strong friend who gives you a hand when in need of performance.

    I like that Rust has strong long term vision, frequent updates, they clearly state which parts of design are final and which might change. And the way they worked around the OOP cliche? Neat.

    I originally started to re-learn C++, buying excellent book - C++ Primer. Going through the book, I was crying of joy seeing the excellent explanations and great teaching style, and crying of pain seeing how much does the long development of C++ hurting the clarity of design. Rust, on the other side, is very hard to grasp at first (reverses lot of expectations), but once you understand the main principles, it is really smooth to use. Compiler with package manager and easy to understand error messages. Wow.

    The place where it really got me is how I could re-implement PowerBASIC/ThinBASIC string in Rust so it is used naturally with the language. Very comfy.

    Now it is possible to write simple thinBASIC modules with Rust, like https://github.com/petrSchreiber/thinbasic_rusty shows. That means DLLs, which do not need any DECLAREs.


    Petr
    Last edited by Petr Schreiber; 23-07-2018 at 20:34.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #17
    Hi Petr
    The place where it really got me is how I could re-implement PowerBASIC/ThinBASIC string in Rust so it is used naturally with the language. Very comfy
    you should go commercial with Powerbasic with the help and arrangement of others and the company itself, if you have provided Rust x64 Dlls for powerbasic :the strings, numerics and maths, graphics, hands, legs, ears, noses, skin...in the form the classic users of PB likes , what remains is the compiler itself in x64, so the big amount of efforts reduced to more than 50%. i saw even in the GitHub a packages which are calling the windows api for Rust. so this is the only horizon i see for the powerbasic airplane to go.
    a small prototype may be done as a showcase for the PB experts to evaluate.

    Edit:
    and why staying with the same compiler core as implemented by BZ in assembly; it is like trying to decipher the pharaoh hieroglyphics scripts, a killer task, it is possible to borrow one of the free x64 compilers and with arrangement of its owner (or using Rust compiler itself for fully Rustified product) just plug in your x64 string and other dlls or say modules, and then you have a new fresh PB x64 compiler which have the taste and flavor of the original PB compiler. this is easier and less costly than trying to decipher the original old code.

    Edit2: i have changed my mind, since the task i have suggested is unimaginable big and making a big stress if it is initialized seriously by one man, it needs a group .
    but i keep my suggestion even it has the signature of mission impossible.
    i will download and try your thinbasic_rusty
    big thanks
    Last edited by primo; 24-07-2018 at 11:45.

  8. #18
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Primo,

    thanks a lot for the encouragement

    PowerBASIC has a special place in my heart - be it countless hours writing 2D and 3D games for PowerBASIC for DOS, discovering the secrets of OpenGL in my teen-era, saving my butt when Microsoft compiler OpenCL bindings broke when working on my diploma thesis and... of course - having fun developing for thinBASIC for 10+ years in it. All of it thanks to support from Eros and José Roca.

    However - I found out I was using ThinBASIC more and more (and yes, it is and will be slower than compiled PB), and returning to PB I found out I miss some cool syntax sugar thinBASIC brought over the years. I use ThinBASIC daily at Avast as well to make my life simpler. It is something like tatoo on my hand, we grow together

    I also have some internal need to play with GPGPU and high performance compilers, and Rust does it for me very well, along with challenging my brain to think differently once again.

    I have some crazy ideas how to boost core ThinBASIC, as well. I can't wait to meet with Eros to discuss it in person with whiteboard to help me organize the thoughts, hehehe


    Petr
    Last edited by Petr Schreiber; 24-07-2018 at 21:44.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #19
    Petr, all the universe is based on crazy ideas , so boosting the speed of thinbasic core to twice or thrice or more will be the most wanted feature.
    Last edited by primo; 26-07-2018 at 10:32.

  10. #20
    i have noticed that the available opengl implementations for Rust https://github.com/rust-unofficial/a...-rust#graphics does not support red book opengl v1.1 , i have tried to find one glTranslate or glRotate in the implementations and can't find, they are all support whats called "modern opengl" which are not tasty at all for all persons over 50 yo.
    so i think of another approach, inspired by Petr work about calling powerbasic dll from Rust. the plan is call powerbasic dll from rust and let the dll call the classic opengl v1.1
    here is an example, i use purebasic DLL because it has a OpenglGadget which makes the user code smaller, and call it from thinbasic to draw a triangle. i have also tested it with rust and it works. here is a show case of what i mean:
    Thinbasic calling code:
    Declare Function MyFunction  Lib "PBDLL.dll" Alias "MyFunction" ()
     
    function tbMain()
     
      MyFunction() 
     
    End Function
    
    Purebasic DLL code:
    OpenWindow(0, 50, 50, 640, 480, "OpenGL demo")
    SetWindowColor(0, 0)
    OpenGLGadget(0, 0, 0, WindowWidth(0) , WindowHeight(0))
      
    ProcedureDLL.l MyFunction()
    
      Repeat
      rot.f+1
      glViewport_(0, 0, WindowWidth(0), WindowHeight(0))
      glMatrixMode_(#GL_PROJECTION)
      glLoadIdentity_()
      gluPerspective_(30.0, Abs(WindowWidth(0) / WindowHeight(0)), 0.1, 500.0)
      glMatrixMode_(#GL_MODELVIEW)
      glLoadIdentity_()
      glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
      glLoadIdentity_()
      glTranslatef_(0.0, 0.0, -8.0)
      glRotatef_(rot, 0,1.0,0)
      glColor3f_(1.0, 1.0, 1.0)
      glBegin_(#GL_TRIANGLES)      ; Start drawing a triangle
      glColor3f_ ( 1.0,  0.0, 0.0) ; Set top point of triangle to Red
      glVertex3f_( 0.0,  1.0, 0.0) ; First point of the triangle
      glColor3f_ ( 0.0,  1.0, 0.0) ; Set left point of triangle to Green
      glVertex3f_(-1.0, -1.0, 0.0) ; Second point of the triangle
      glColor3f_ ( 0.0,  0.0, 1.0) ; Set right point of triangle to Blue
      glVertex3f_( 1.0, -1.0, 0.0) ; Third point of the triangle
      glEnd_()                     ; Done drawing the triangle
      SetGadgetAttribute(0, #PB_OpenGL_FlipBuffers, #True)
      Until WindowEvent() = #PB_Event_CloseWindow
      EndProcedure
    
    attached the pb dll for convenience (checked with https://www.virustotal.com and found totally clean 0 / 66)
    Attached Files Attached Files

Page 2 of 3 FirstFirst 123 LastLast

Members who have read this thread: 1

Posting Permissions

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