Project

General

Profile

Download (20.5 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / mesh / MeshBase.java @ de53cf3e

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.library.mesh;
21

    
22
import android.opengl.GLES31;
23
import android.opengl.Matrix;
24

    
25
import org.distorted.library.effect.MatrixEffect;
26
import org.distorted.library.main.DistortedLibrary;
27
import org.distorted.library.main.InternalBuffer;
28
import org.distorted.library.program.DistortedProgram;
29

    
30
import java.util.ArrayList;
31

    
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33
/**
34
 * Abstract class which represents a Mesh, ie an array of vertices (rendered as a TRIANGLE_STRIP).
35
 * <p>
36
 * If you want to render to a particular shape, extend from here, construct a float array
37
 * containing per-vertex attributes, and call back setAttribs().
38
 */
39
public abstract class MeshBase
40
   {
41
   // sizes of attributes of an individual vertex.
42
   private static final int POS_DATA_SIZE= 3; // vertex coordinates: x,y,z
43
   private static final int NOR_DATA_SIZE= 3; // normal vector: x,y,z
44
   private static final int INF_DATA_SIZE= 3; // 'inflate' vector: x,y,z
45
   private static final int TEX_DATA_SIZE= 2; // texture coordinates: s,t
46

    
47
   static final int POS_ATTRIB   = 0;
48
   static final int NOR_ATTRIB   = POS_DATA_SIZE;
49
   static final int INF_ATTRIB   = POS_DATA_SIZE + NOR_DATA_SIZE;
50
   static final int TEX_ATTRIB   = POS_DATA_SIZE + NOR_DATA_SIZE + INF_DATA_SIZE;
51
   static final int VERT_ATTRIBS = POS_DATA_SIZE + NOR_DATA_SIZE + INF_DATA_SIZE + TEX_DATA_SIZE;  // number of attributes of a 'normal' vertex
52
   static final int TRAN_ATTRIBS = POS_DATA_SIZE + POS_DATA_SIZE;                                  // number of attributes of a transform feedback vertex
53

    
54
   private static final int BYTES_PER_FLOAT = 4;
55

    
56
   private static final int OFFSET_POS = POS_ATTRIB*BYTES_PER_FLOAT;
57
   private static final int OFFSET_NOR = NOR_ATTRIB*BYTES_PER_FLOAT;
58
   private static final int OFFSET_INF = INF_ATTRIB*BYTES_PER_FLOAT;
59
   private static final int OFFSET_TEX = TEX_ATTRIB*BYTES_PER_FLOAT;
60
   private static final int TRAN_SIZE  = TRAN_ATTRIBS*BYTES_PER_FLOAT;
61
   private static final int VERT_SIZE  = VERT_ATTRIBS*BYTES_PER_FLOAT;
62

    
63
   private boolean mShowNormals;      // when rendering this mesh, draw normal vectors?
64
   private InternalBuffer mVBO, mTFO; // main vertex buffer and transform feedback buffer
65
   private int mNumVertices;
66
   private float[] mVertAttribs;      // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, InfX,InfY,InfZ, TexS,TexT
67
   private float mInflate;
68
   private float mBoundingX, mBoundingY, mBoundingZ;
69
   private float mStretchX, mStretchY, mStretchZ;
70

    
71
   private class Component
72
     {
73
     private int mEndIndex;
74
     private float[] mTextureMap;
75

    
76
     Component(int end)
77
       {
78
       mEndIndex = end;
79

    
80
       mTextureMap    = new float[4];
81
       mTextureMap[0] = 0.0f;  // LowerLeft_X
82
       mTextureMap[1] = 0.0f;  // LowerLeft_Y
83
       mTextureMap[2] = 1.0f;  // Width
84
       mTextureMap[3] = 1.0f;  // Height
85
       }
86
     Component(Component original)
87
       {
88
       mEndIndex = original.mEndIndex;
89
       mTextureMap = new float[4];
90
       System.arraycopy(original.mTextureMap,0,mTextureMap,0,4);
91
       }
92

    
93
     void setMap(float[] newMap)
94
       {
95
       System.arraycopy(newMap,0,mTextureMap,0,4);
96
       }
97
     }
98

    
99
   private ArrayList<Component> mComponent;
100

    
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102

    
103
   MeshBase(float bx, float by, float bz)
104
     {
105
     mBoundingX = bx/2;
106
     mBoundingY = by/2;
107
     mBoundingZ = bz/2;
108

    
109
     mStretchX = 1.0f;
110
     mStretchY = 1.0f;
111
     mStretchZ = 1.0f;
112

    
113
     mShowNormals = false;
114
     mInflate     = 0.0f;
115
     mComponent   = new ArrayList<>();
116

    
117
     mVBO = new InternalBuffer(GLES31.GL_ARRAY_BUFFER             , GLES31.GL_STATIC_READ);
118
     mTFO = new InternalBuffer(GLES31.GL_TRANSFORM_FEEDBACK_BUFFER, GLES31.GL_STATIC_READ);
119
     }
120

    
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122
// copy constructor
123

    
124
   MeshBase(MeshBase original)
125
     {
126
     mBoundingX = original.mBoundingX;
127
     mBoundingY = original.mBoundingY;
128
     mBoundingZ = original.mBoundingZ;
129

    
130
     mStretchX = original.mStretchX;
131
     mStretchY = original.mStretchY;
132
     mStretchZ = original.mStretchZ;
133

    
134
     mShowNormals = original.mShowNormals;
135
     mInflate     = original.mInflate;
136

    
137
     int size = original.mComponent.size();
138
     mComponent = new ArrayList<>();
139
     for(int i=0; i<size; i++)
140
       {
141
       Component comp = new Component(original.mComponent.get(i));
142
       mComponent.add(comp);
143
       }
144

    
145
     mVBO = new InternalBuffer(GLES31.GL_ARRAY_BUFFER             , GLES31.GL_STATIC_READ);
146
     mTFO = new InternalBuffer(GLES31.GL_TRANSFORM_FEEDBACK_BUFFER, GLES31.GL_STATIC_READ);
147

    
148
     System.arraycopy(original.mVertAttribs,0,mVertAttribs,0,original.mNumVertices*VERT_ATTRIBS);
149
     setAttribs(mVertAttribs);
150
     }
151

    
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153

    
154
   int numComponents()
155
     {
156
     return mComponent.size();
157
     }
158

    
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

    
161
   void setBounding(float bx, float by, float bz)
162
     {
163
     mBoundingX = bx/2;
164
     mBoundingY = by/2;
165
     mBoundingZ = bz/2;
166
     }
167

    
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169
// when a derived class is done computing its mesh, it has to call this method.
170

    
171
   void setAttribs(float[] vertexAttribs)
172
     {
173
     mNumVertices = vertexAttribs.length/VERT_ATTRIBS;
174
     mVertAttribs = vertexAttribs;
175

    
176
     mComponent.add(new Component(mNumVertices));
177

    
178
     mVBO.invalidate();
179
     mTFO.invalidate();
180
     }
181

    
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183
// called from MeshJoined
184

    
185
   void join(MeshBase[] meshes)
186
     {
187
     MeshBase mesh;
188
     Component comp;
189
     int com, num, len = meshes.length;
190
     int origVertices = mNumVertices;
191

    
192
     // compute new numVertices; take care of Components
193

    
194
     if( origVertices>0 )
195
       {
196
       com = mComponent.size();
197
       mNumVertices+= ( mNumVertices%2==1 ? 2:1 );
198
       mComponent.get(com-1).mEndIndex = mNumVertices;
199
       }
200

    
201
     for(int i=0; i<len; i++)
202
       {
203
       mesh = meshes[i];
204
       com = mesh.mComponent.size();
205

    
206
       for(int j=0; j<com; j++)
207
         {
208
         comp = new Component(mesh.mComponent.get(j));
209
         comp.mEndIndex += mNumVertices;
210
         mComponent.add(comp);
211
         }
212

    
213
       num = mesh.mNumVertices;
214

    
215
       if( mNumVertices==0 ) mNumVertices += (num%2==1 ? num+2 : num+1);
216
       else if( i==len-1 )   mNumVertices += (num+1);
217
       else                  mNumVertices += (num%2==1 ? num+3 : num+2);
218
       }
219

    
220
     // allocate new attrib array
221
     float[] newAttribs = new float[VERT_ATTRIBS*mNumVertices];
222
     num = origVertices;
223

    
224
     if( origVertices>0 )
225
       {
226
       System.arraycopy(mVertAttribs,                             0, newAttribs,                         0, VERT_ATTRIBS*num);
227
       System.arraycopy(mVertAttribs, VERT_ATTRIBS*(origVertices-1), newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS    );
228
       origVertices++;
229

    
230
       if( num%2==1 )
231
         {
232
         System.arraycopy(mVertAttribs, VERT_ATTRIBS*(origVertices-1), newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS);
233
         origVertices++;
234
         }
235
       }
236

    
237
     for(int i=0; i<len; i++)
238
       {
239
       mesh = meshes[i];
240
       num = mesh.mNumVertices;
241

    
242
       if( origVertices>0 )
243
         {
244
         System.arraycopy(mesh.mVertAttribs, 0, newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS    );
245
         origVertices++;
246
         }
247
       System.arraycopy(mesh.mVertAttribs, 0, newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS*num);
248
       origVertices+=num;
249

    
250
       if( i<len-1 )
251
         {
252
         System.arraycopy(mesh.mVertAttribs, VERT_ATTRIBS*(num-1), newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS);
253
         origVertices++;
254

    
255
         if( num%2==1 )
256
           {
257
           System.arraycopy(mesh.mVertAttribs, VERT_ATTRIBS*(num-1), newAttribs, VERT_ATTRIBS*origVertices, VERT_ATTRIBS);
258
           origVertices++;
259
           }
260
         }
261
       }
262

    
263
     if( origVertices!=mNumVertices )
264
       {
265
       android.util.Log.e("mesh", "join: origVertices: "+origVertices+" numVertices: "+mNumVertices);
266
       }
267

    
268
     mVertAttribs = newAttribs;
269

    
270
     mVBO.invalidate();
271
     }
272

    
273
///////////////////////////////////////////////////////////////////////////////////////////////////
274
/**
275
 * Not part of public API, do not document (public only because has to be used from the main package)
276
 *
277
 * @y.exclude
278
 */
279
   public int getTFO()
280
     {
281
     return mTFO.mIndex[0];
282
     }
283

    
284
///////////////////////////////////////////////////////////////////////////////////////////////////
285
/**
286
 * Not part of public API, do not document (public only because has to be used from the main package)
287
 *
288
 * @y.exclude
289
 */
290
   public int getNumVertices()
291
     {
292
     return mNumVertices;
293
     }
294

    
295
///////////////////////////////////////////////////////////////////////////////////////////////////
296
/**
297
 * Not part of public API, do not document (public only because has to be used from the main package)
298
 *
299
 * @y.exclude
300
 */
301
   public void bindVertexAttribs(DistortedProgram program)
302
     {
303
     mVBO.createImmediately(mNumVertices*VERT_SIZE, mVertAttribs);
304

    
305
     GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mVBO.mIndex[0] );
306
     GLES31.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_POS);
307
     GLES31.glVertexAttribPointer(program.mAttribute[1], NOR_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_NOR);
308
     GLES31.glVertexAttribPointer(program.mAttribute[2], INF_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_INF);
309
     GLES31.glVertexAttribPointer(program.mAttribute[3], TEX_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_TEX);
310
     GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, 0);
311
     }
312

    
313
///////////////////////////////////////////////////////////////////////////////////////////////////
314
/**
315
 * Not part of public API, do not document (public only because has to be used from the main package)
316
 *
317
 * @y.exclude
318
 */
319
   public void bindTransformAttribs(DistortedProgram program)
320
     {
321
     mTFO.createImmediately(mNumVertices*TRAN_SIZE, null);
322

    
323
     GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mTFO.mIndex[0] );
324
     GLES31.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES31.GL_FLOAT, false, 0, 0);
325
     GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, 0);
326
     }
327

    
328
///////////////////////////////////////////////////////////////////////////////////////////////////
329
/**
330
 * Not part of public API, do not document (public only because has to be used from the main package)
331
 *
332
 * @y.exclude
333
 */
334
   public void setInflate(float inflate)
335
     {
336
     mInflate = inflate;
337
     }
338

    
339
///////////////////////////////////////////////////////////////////////////////////////////////////
340
/**
341
 * Not part of public API, do not document (public only because has to be used from the main package)
342
 *
343
 * @y.exclude
344
 */
345
   public float getInflate()
346
     {
347
     return mInflate;
348
     }
349

    
350
///////////////////////////////////////////////////////////////////////////////////////////////////
351
// PUBLIC API
352
///////////////////////////////////////////////////////////////////////////////////////////////////
353
/**
354
 * When rendering this Mesh, do we want to render the Normal vectors as well?
355
 * <p>
356
 * Will work only on OpenGL ES >= 3.0 devices.
357
 *
358
 * @param show Controls if we render the Normal vectors or not.
359
 */
360
   public void setShowNormals(boolean show)
361
     {
362
     mShowNormals = (DistortedLibrary.GLSL >= 300 && show);
363
     }
364

    
365
///////////////////////////////////////////////////////////////////////////////////////////////////
366
/**
367
 * When rendering this mesh, should we also draw the normal vectors?
368
 *
369
 * @return <i>true</i> if we do render normal vectors
370
 */
371
   public boolean getShowNormals()
372
     {
373
     return mShowNormals;
374
     }
375

    
376
///////////////////////////////////////////////////////////////////////////////////////////////////
377
/**
378
 * Release all internal resources.
379
 */
380
   public void markForDeletion()
381
     {
382
     mVertAttribs = null;
383

    
384
     mVBO.markForDeletion();
385
     mTFO.markForDeletion();
386
     }
387

    
388
///////////////////////////////////////////////////////////////////////////////////////////////////
389
/**
390
 * Apply all Effects to the vertex mesh. Overwrite the mesh in place.
391
 * <p>
392
 * This is a static, permanent modification of the vertices contained in this Mesh. If the effects
393
 * contain any Dynamics, they will be evaluated at 0.
394
 *
395
 * Please note that calling this once with the complete list of Effects will be much faster than
396
 * calling it repeatedly with one Effect at a time, as we have to reallocate the array of vertices
397
 * each time.
398
 */
399
   public void apply(MatrixEffect[] effects)
400
     {
401
     float[][] matrix = new float[effects.length][16];
402
     float[] tmp;
403
     float[] array = new float[7];
404
     float x,y,z;
405
     int numEffects = 0;
406

    
407
     for(MatrixEffect eff: effects)
408
       {
409
       if( eff!=null )
410
         {
411
         Matrix.setIdentityM(matrix[numEffects],0);
412
         eff.compute(array,0,0,0);
413
         eff.apply(matrix[numEffects], array, 0);
414
         numEffects++;
415
         }
416
       }
417

    
418
     for(int index=0; index<mNumVertices*VERT_ATTRIBS; index+=VERT_ATTRIBS )
419
       {
420
       for(int mat=0; mat<numEffects; mat++)
421
         {
422
         tmp = matrix[mat];
423

    
424
         x = mVertAttribs[index+POS_ATTRIB  ];
425
         y = mVertAttribs[index+POS_ATTRIB+1];
426
         z = mVertAttribs[index+POS_ATTRIB+2];
427

    
428
         mVertAttribs[index+POS_ATTRIB  ] = tmp[0]*x + tmp[4]*y + tmp[ 8]*z + tmp[12];
429
         mVertAttribs[index+POS_ATTRIB+1] = tmp[1]*x + tmp[5]*y + tmp[ 9]*z + tmp[13];
430
         mVertAttribs[index+POS_ATTRIB+2] = tmp[2]*x + tmp[6]*y + tmp[10]*z + tmp[14];
431

    
432
         x = mVertAttribs[index+NOR_ATTRIB  ];
433
         y = mVertAttribs[index+NOR_ATTRIB+1];
434
         z = mVertAttribs[index+NOR_ATTRIB+2];
435

    
436
         mVertAttribs[index+NOR_ATTRIB  ] = tmp[0]*x + tmp[4]*y + tmp[ 8]*z;
437
         mVertAttribs[index+NOR_ATTRIB+1] = tmp[1]*x + tmp[5]*y + tmp[ 9]*z;
438
         mVertAttribs[index+NOR_ATTRIB+2] = tmp[2]*x + tmp[6]*y + tmp[10]*z;
439

    
440
         x = mVertAttribs[index+INF_ATTRIB  ];
441
         y = mVertAttribs[index+INF_ATTRIB+1];
442
         z = mVertAttribs[index+INF_ATTRIB+2];
443

    
444
         mVertAttribs[index+INF_ATTRIB  ] = tmp[0]*x + tmp[4]*y + tmp[ 8]*z;
445
         mVertAttribs[index+INF_ATTRIB+1] = tmp[1]*x + tmp[5]*y + tmp[ 9]*z;
446
         mVertAttribs[index+INF_ATTRIB+2] = tmp[2]*x + tmp[6]*y + tmp[10]*z;
447
         }
448
       }
449

    
450
     mTFO.invalidate();
451
     }
452

    
453
///////////////////////////////////////////////////////////////////////////////////////////////////
454
/**
455
 * Sets texture maps for all components of this mesh.
456
 * <p>
457
 * Please note that calling this once with the complete list of Maps will be much faster than
458
 * calling it repeatedly with one Maps at a time, as we have to reallocate the array of vertices
459
 * each time.
460
 * 'maps' needs to be maps[NumComponentsInThisMesh][4]. [0] is the lower-left corner's X, [1]- its Y,
461
 * [2] - width, [3] - height of the map.
462
 * For example map[0] = new float { 0.0, 0.5, 0.5, 0.5 } sets the 0th component texture map to the
463
 * upper-left quadrant of the texture.
464
 */
465
   public void setTextureMap(float[][] maps)
466
     {
467
     int num_comp = mComponent.size();
468
     int num_maps = maps.length;
469
     int min = num_comp<num_maps ? num_comp : num_maps;
470
     int vertex = 0;
471
     int index  = TEX_ATTRIB;
472
     float[] newMap, oldMap;
473
     Component comp;
474

    
475
     for(int i=0; i<min; i++)
476
       {
477
       if( maps[i]!=null && maps[i][2]!=0.0f && maps[i][3]!=0.0f )
478
         {
479
         comp = mComponent.get(i);
480
         newMap = maps[i];
481
         oldMap = comp.mTextureMap;
482

    
483
         for( ; vertex<=comp.mEndIndex; vertex++, index+=VERT_ATTRIBS)
484
           {
485
           mVertAttribs[index  ] = (newMap[2]/oldMap[2])*(mVertAttribs[index  ]-oldMap[0]) + newMap[0];
486
           mVertAttribs[index+1] = (newMap[3]/oldMap[3])*(mVertAttribs[index+1]-oldMap[1]) + newMap[1];
487
           }
488
         comp.setMap(newMap);
489
         }
490
       }
491

    
492
     mTFO.invalidate();
493
     }
494

    
495
///////////////////////////////////////////////////////////////////////////////////////////////////
496
/**
497
 * Each mesh has its 'bounding box' - return half of its X-length.
498
 * <p>
499
 * In case of all 'simple' Meshes, the bounding box is always 1x1x1 (Sphere, Cubes) or 1x1x0
500
 * (Rectangles, Triangles, Quad - i.e. all 'flat' Meshes). But this can be something else in case of
501
 * MeshComponent.
502
 */
503
   public float getBoundingX()
504
    {
505
    return mBoundingX*mStretchX;
506
    }
507

    
508
///////////////////////////////////////////////////////////////////////////////////////////////////
509
/**
510
 * Each mesh has its 'bounding box' - return half of its Y-length.
511
 */
512
   public float getBoundingY()
513
    {
514
    return mBoundingY*mStretchY;
515
    }
516

    
517
///////////////////////////////////////////////////////////////////////////////////////////////////
518
/**
519
 * Each mesh has its 'bounding box' - return half of its Z-length.
520
 */
521
   public float getBoundingZ()
522
    {
523
    return mBoundingZ*mStretchZ;
524
    }
525

    
526
///////////////////////////////////////////////////////////////////////////////////////////////////
527
/**
528
 * Sometimes we want to display a Mesh on a rectangular screen. Then we need to stretch it by
529
 * different factors in x and y (or z) directions. If we also wanted do display some vertex effects
530
 * done on this mesh, let's say a bulge done by a Distort effect, and wanted the bulge to be round,
531
 * (i.e the same in x and y directions) then doing so without this method would be impossible.
532
 *
533
 * This sets 'stretch' factors in each 3 dimensions. All vertices of this Mesh will be premultiplied
534
 * by those factors in the very first line of the Vertex Shader, before any Effects are done on it.
535
 * Using this we can thus pre-stretch the mesh to aspect ratio equal to the surface we eventually
536
 * want to display the Mesh on, and this way we can achieve a round Distort bulge!
537
 *
538
 * This could also be used to pre-stretch a Rectangles Mesh to a size equal (in pixels) to the bitmap
539
 * this mesh is textured with - and this lets us work with all Effects in natural, pixel units.
540
 *
541
 * @param sx stretch factor in x.
542
 * @param sy stretch factor in y.
543
 * @param sz stretch factor in z.
544
 */
545
   public void setStretch(float sx, float sy, float sz)
546
     {
547
     mStretchX = sx;
548
     mStretchY = sy;
549
     mStretchZ = sz;
550
     }
551

    
552
///////////////////////////////////////////////////////////////////////////////////////////////////
553
/**
554
 * Returns the x-factor set by setStretch().
555
 */
556
   public float getStretchX()
557
     {
558
     return mStretchX;
559
     }
560

    
561
///////////////////////////////////////////////////////////////////////////////////////////////////
562
/**
563
 * Returns the y-factor set by setStretch().
564
 */
565
   public float getStretchY()
566
     {
567
     return mStretchY;
568
     }
569

    
570
///////////////////////////////////////////////////////////////////////////////////////////////////
571
/**
572
 * Returns the z-factor set by setStretch().
573
 */
574
   public float getStretchZ()
575
     {
576
     return mStretchZ;
577
     }
578
   }
579

    
580

    
581

    
(1-1/7)