POV-Ray : Newsgroups : povray.advanced-users : Location changing while scaling Server Time
14 Oct 2024 13:13:21 EDT (-0400)
  Location changing while scaling (Message 1 to 1 of 1)  
From: yesbird
Subject: Location changing while scaling
Date: 2 Sep 2024 05:41:48
Message: <66d5885c@news.povray.org>
Hi, all !

While playing with meshes I've encountered strange behavior of spheres,
positioned at mesh vertices - after changing the scale they move from
previous location (see images). Looks like the scale operation applied
to a whole array of spheres, produced by loop, but the scale operator is
inside the sphere object. I expected they would stay in place and only
change the size.

What I'm missing ? Any suggestions please ...
--
YB

// ------------------------------------------------------------------
#version 3.8;
global_settings { assumed_gamma 1 }

camera {
   perspective
   angle 25
   location  <20,15,20> * 0.2
   look_at   <0.5,0.5,0>
   right x * image_width / image_height
}

light_source{<-500,0,0> rgb 1} light_source{<500,0,0> rgb 1}
light_source{<0,0,-500> rgb 1} light_source{<0,0,500> rgb 1}
light_source{<20,15,20> rgb 0.4}

#declare VertexVectors= array[24] {
   <0,0,0>, <0.5,0,0>, <0.5,0.5,0>, //1
   <0.5,0,0>, <1,0,0>, <0.5,0.5,0>, //2
   <1,0,0>, <1,0.5,0>, <0.5,0.5,0>, //3
   <1,0.5,0>, <1,1,0>, <0.5,0.5,0>, //4
   <1,1,0>, <0.5,1,0>, <0.5,0.5,0>, //5
   <0.5,1,0>, <0,1,0>, <0.5,0.5,0>, //6
   <0,1,0>, <0,0.5,0>, <0.5,0.5,0>, //7
   <0,0.5,0>, <0,0,0>, <0.5,0.5,0>  //8
}

// Mesh
mesh2 {
    #local len = dimension_size(VertexVectors,1);
    vertex_vectors {
       len,
           #for (i, 0, len-1)
             VertexVectors[i]
           #end
    }

    face_indices {
       8,
       <0,1,2>,    <3,4,5>,       //1 2
       <6,7,8>,    <9,10,11>,     //3 4
       <12,13,14>, <15,16,17>,    //5 6
       <18,19,20>, <21,22,23>     //7 8
    }

    pigment {rgb 1}
}

// Spheres
#local len = dimension_size(VertexVectors,1) - 1;
#for (i, 0, len)
   sphere { VertexVectors[i], 0.04
            texture { pigment {rgb <0.1, 0.3, 0.1>} }
            scale y * 1.2 // Why they moves ?
   }
#end
// ------------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'test_scale_no.png' (12 KB) Download 'test_scale_yes.png' (12 KB)

Preview of image 'test_scale_no.png'
test_scale_no.png

Preview of image 'test_scale_yes.png'
test_scale_yes.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.